Fixed bug when playing with translations and constructing science, gold or nothing in a city

This commit is contained in:
Yair Morgenstern
2018-08-12 20:45:17 +03:00
parent 4c0372a8b5
commit bb25616b69
4 changed files with 15 additions and 5 deletions

View File

@ -69,6 +69,16 @@ class UnitAutomation{
// if both failed, then... there aren't any reachable tiles. Which is possible.
}
fun rankTileForHealing(tileInfo: TileInfo, unit: MapUnit): Int {
val tileOwner = tileInfo.getOwner()
when{
tileInfo.isCityCenter() -> return 3
tileOwner!=null && !unit.civInfo.isAtWarWith(tileOwner)-> return 2
tileOwner==null -> return 1
else -> return 0
}
}
fun healUnit(unit:MapUnit) {
val tilesInDistance = unit.getDistanceToTiles().keys
val unitTile = unit.getTile()
@ -112,7 +122,6 @@ class UnitAutomation{
val tilesToAttackFrom = distanceToTiles.filter { unit.currentMovement - it.value > 0.1 }
.map { it.key }
.filter { unit.canMoveTo(it) || it==unit.getTile() }
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
val tilesInAttackRange = if (unit.hasUnique("Indirect fire")) reachableTile.getTilesInDistance(rangeOfAttack)
else reachableTile.getViewableTiles(rangeOfAttack)

View File

@ -44,14 +44,14 @@ class CityConstructions {
fun getCityProductionTextForCityButton(): String {
var result = currentConstruction.tr()
if (SpecialConstruction.getSpecialConstructions().none { it.name==result })
if (SpecialConstruction.getSpecialConstructions().none { it.name==currentConstruction })
result += "\r\n" + turnsToConstruction(currentConstruction) + " {turns}".tr()
return result
}
fun getProductionForTileInfo(): String {
var result = currentConstruction.tr()
if (SpecialConstruction.getSpecialConstructions().none { it.name==result })
if (SpecialConstruction.getSpecialConstructions().none { it.name==currentConstruction })
result += "\r\n{in} ".tr() + turnsToConstruction(currentConstruction) + " {turns}".tr()
return result
}

View File

@ -183,6 +183,7 @@ class WorldScreen : CameraStageBaseScreen() {
catch (ex:Exception){
UnCivGame.Current.settings.hasCrashedRecently=true
UnCivGame.Current.settings.save()
throw ex
}
// If we put this BEFORE the save game, then we try to save the game...