Translation stuff

Fixed ultra rare bug where a unit that expends all its movement points on roads right before attacking will think that it can attack when it can't
This commit is contained in:
Yair Morgenstern
2018-06-25 20:08:57 +03:00
parent a235167116
commit a59d6e7a46
8 changed files with 39 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1170,6 +1170,8 @@
// Technologies (Ancient Era)
"Agriculture":{}
"Pottery":{
Italian:"Ceramica"
Russian:"Керамика"
@ -1325,6 +1327,7 @@
Romanian:"Serviciu civil"
German:"Zivildienst"
}
"Guilds":{}
"Physics":{
Italian:"Fisica"
Russian:"Физика"
@ -1332,6 +1335,7 @@
Romanian:"Fizică"
German:"Physik"
}
"Steel":{}
"Metal Casting":{
Italian:"colata di metallo"
Russian:"Литье"
@ -1399,6 +1403,7 @@
Romanian:"Presă de tipar"
German:"Druckpresse"
}
"Gunpowder":{}
"Navigation":{
Italian:"Navigazione"
Russian:"Навигация"
@ -1420,6 +1425,9 @@
Romanian:"Economie"
German:"Ökonomie"
}
"Metallurgy":{}
"Chemistry":{
Italian:"Chimica"
Russian:"Химия"
@ -1437,6 +1445,11 @@
Romanian:"Teoria științifică"
German:"Wissenschaftliche Thorie"
}
"Industrialization":{}
"Rifling":{}
"Military Science":{}
"Fertilizer":{
Italian:"Fertilizzante"
Russian:"Yдобрение"
@ -1466,6 +1479,8 @@
German:"Dampfkraft"
}
"Dynamite":{}
// Technologies (Modern Era)
@ -1594,6 +1609,16 @@
German:"Zukünftige Technologien"
}
// Tech Eras
"Ancient":{}
"Classical":{}
"Medieval":{}
"Renaissance":{}
"Industrial":{}
"Modern":{}
"Information":{}
"Future":{}
// Building unique abilities
"+1 Science Per 2 Population":{

View File

@ -234,9 +234,8 @@
cost: 150,
requiredTech:"Gunpowder",
hurryCostModifier:20
}
,{
},
{
name:"Lancer",
unitType:"Mounted",
movement:4,
@ -245,10 +244,11 @@
requiredTech:"Metallurgy",
requiredResource:"Horses",
hurryCostModifier:20
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 50%" ],
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 33%" ],
},
// UNITS FROM HERE NEED IMAGES
// Industrial Era
{
name:"Rifleman",
unitType:"Melee",

View File

@ -49,7 +49,13 @@ class UnitAutomation{
val rangeOfAttack = if(MapUnitCombatant(unit).isMelee()) 1 else unit.getBaseUnit().range
val attackableTiles = ArrayList<AttackableTile>()
val tilesToAttackFrom = distanceToTiles.filter { it.value!=unit.currentMovement }.map { it.key }
// The +0.09 solves a bug where you've moved 2/3 road tiles,
// you come to move a third (distance is less that remaining movements),
// and then later we round it off to a whole.
// So the poor unit thought it could attack from the tile, but when it comes to do so it has no moveement points!
// Silly floats, basically
val tilesToAttackFrom = distanceToTiles.filter { (it.value+0.09) < unit.currentMovement }
.map { it.key }
.filter { unit.canMoveTo(it) || it==unit.getTile() }
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
attackableTiles += reachableTile.getTilesInDistance(rangeOfAttack).filter { it in tilesWithEnemies }

View File

@ -30,7 +30,7 @@ class Technology : ICivilopedia {
if(wonders.isNotEmpty()) SB.appendln("{Wonders enabled}: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString())
val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.map { it.name }.firstOrNull() // can only be one
if(revealedResource!=null) SB.appendln("Reveals [$revealedResource] on map".tr())
if(revealedResource!=null) SB.appendln("Reveals [$revealedResource] on the map".tr())
val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name }
if(tileImprovements.isNotEmpty()) SB.appendln("{Tile improvements enabled}: "+tileImprovements.map { it.name }.joinToString())

View File

@ -160,7 +160,7 @@ fun String.tr(): String {
var languageSpecificPlaceholder = GameBasics.Translations[englishTranslationPlaceholder]!![UnCivGame.Current.settings.language]!!
for(i in 0 until termsInMessage.size){
languageSpecificPlaceholder = languageSpecificPlaceholder.replace(termsInTranslationPlaceholder[i], termsInMessage[i])
languageSpecificPlaceholder = languageSpecificPlaceholder.replace(termsInTranslationPlaceholder[i], termsInMessage[i].tr())
}
return languageSpecificPlaceholder.tr()
}