Fixed all renamed units being called 'instanceName' (#5140)

* Fixed all renamed units being called 'instanceName'

* Removed extreneous square brackets resulting in incorrect translations

* Fixed translation problems
This commit is contained in:
Xander Lenstra
2021-09-08 19:42:27 +02:00
committed by GitHub
parent 69e2828a0e
commit 9a29ce8422
4 changed files with 10 additions and 5 deletions

View File

@ -495,7 +495,7 @@ object UnitAutomation {
if (unit.isDestroyed) return // Opening ruins _might_ have upgraded us to another unit
if (unit.health < 80 && tryHealUnit(unit)) return
if (tryExplore(unit)) return
unit.civInfo.addNotification("[${unit.displayName()}] finished exploring.", unit.currentTile.position, unit.name, "OtherIcons/Sleep")
unit.civInfo.addNotification("${unit.shortDisplayName()} finished exploring.", unit.currentTile.position, unit.name, "OtherIcons/Sleep")
unit.action = null
}

View File

@ -170,7 +170,7 @@ class WorkerAutomation(
if (WorkerAutomationConst.consoleOutput)
println("WorkerAutomation: ${unit.label()} -> nothing to do")
unit.civInfo.addNotification("[${unit.displayName()}] has no work to do.", currentTile.position, unit.name, "OtherIcons/Sleep")
unit.civInfo.addNotification("${unit.shortDisplayName()} has no work to do.", currentTile.position, unit.name, "OtherIcons/Sleep")
}
/**

View File

@ -644,8 +644,8 @@ class CivilizationInfo {
val unitToDisband = civMilitaryUnits.first()
unitToDisband.disband()
civMilitaryUnits -= unitToDisband
val unitName = unitToDisband.displayName()
addNotification("Cannot provide unit upkeep for [$unitName] - unit has been disbanded!", unitName, NotificationIcon.Death)
val unitName = unitToDisband.shortDisplayName()
addNotification("Cannot provide unit upkeep for $unitName - unit has been disbanded!", unitName, NotificationIcon.Death)
}
}
}

View File

@ -111,11 +111,16 @@ class MapUnit {
fun displayName(): String {
val baseName =
if (instanceName == null) "[$name]"
else "instanceName ([$name])"
else "$instanceName ([$name])"
return if (religion == null) baseName
else "$baseName ([${getReligionDisplayName()}])"
}
fun shortDisplayName(): String {
return if (instanceName != null) "[$instanceName]"!!
else "[$name]"
}
var currentMovement: Float = 0f
var health: Int = 100