mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-30 14:48:56 +07:00
On second thoughts let's not have a field and function named the same
This commit is contained in:
@ -82,7 +82,7 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
||||
var attackedThisTurn = false
|
||||
var hasSoldBuildingThisTurn = false
|
||||
var isPuppet = false
|
||||
var reassignPopulation = false // flag so that on startTurn() we reassign population
|
||||
var shouldReassignPopulation = false // flag so that on startTurn() we reassign population
|
||||
|
||||
@delegate:Transient
|
||||
val neighboringCities: List<City> by lazy {
|
||||
@ -139,7 +139,7 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
||||
toReturn.isOriginalCapital = isOriginalCapital
|
||||
toReturn.flagsCountdown.putAll(flagsCountdown)
|
||||
toReturn.demandedResource = demandedResource
|
||||
toReturn.reassignPopulation = reassignPopulation
|
||||
toReturn.shouldReassignPopulation = shouldReassignPopulation
|
||||
toReturn.cityAIFocus = cityAIFocus
|
||||
toReturn.avoidGrowth = avoidGrowth
|
||||
toReturn.manualSpecialists = manualSpecialists
|
||||
@ -315,19 +315,19 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
||||
}
|
||||
if (!manualSpecialists)
|
||||
population.specialistAllocations.clear()
|
||||
reassignPopulation = false
|
||||
shouldReassignPopulation = false
|
||||
population.autoAssignPopulation()
|
||||
}
|
||||
|
||||
/** Apply worked tiles optimization (aka CityFocus) -
|
||||
* immediately for a human player whoes turn it is (interactive),
|
||||
* or deferred to the next startTurn while nextTurn is running (for AI)
|
||||
* @see reassignPopulation
|
||||
* @see shouldReassignPopulation
|
||||
*/
|
||||
fun reassignPopulationDeferred() {
|
||||
// TODO - is this the best (or even correct) way to detect "interactive" UI calls?
|
||||
if (GUI.isMyTurn() && GUI.getViewingPlayer() == civ) reassignPopulation()
|
||||
else reassignPopulation = true
|
||||
else shouldReassignPopulation = true
|
||||
}
|
||||
|
||||
fun destroyCity(overrideSafeties: Boolean = false) {
|
||||
|
@ -358,7 +358,7 @@ class CityStats(val city: City) {
|
||||
if (tile.isBlockaded() && city.isWorked(tile)) {
|
||||
city.workedTiles.remove(tile.position)
|
||||
city.lockedTiles.remove(tile.position)
|
||||
city.reassignPopulation = true
|
||||
city.shouldReassignPopulation = true
|
||||
continue
|
||||
}
|
||||
val tileStats = tile.stats.getTileStats(city, city.civ, localUniqueCache)
|
||||
@ -468,7 +468,7 @@ class CityStats(val city: City) {
|
||||
|
||||
if (DebugUtils.SUPERCHARGED) {
|
||||
val stats = Stats()
|
||||
for (stat in Stat.values()) stats[stat] = 10000f
|
||||
for (stat in Stat.entries) stats[stat] = 10000f
|
||||
newStatsBonusTree.addStats(stats, "Supercharged")
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class CityConquestFunctions(val city: City) {
|
||||
fun annexCity() {
|
||||
city.isPuppet = false
|
||||
city.cityConstructions.inProgressConstructions.clear() // undo all progress of the previous civ on units etc.
|
||||
if (!city.isInResistance()) city.reassignPopulation = true
|
||||
if (!city.isInResistance()) city.shouldReassignPopulation = true
|
||||
city.setCityFocus(CityFocus.NoFocus)
|
||||
city.cityStats.update()
|
||||
GUI.setUpdateWorldOnNextRender()
|
||||
|
@ -118,7 +118,7 @@ class CityPopulationManager : IsPartOfGameInfoSerialization {
|
||||
.coerceAtMost(95) // Try to avoid runaway food gain in mods, just in case
|
||||
foodStored += (foodNeededToGrow * percentOfFoodCarriedOver / 100f).toInt()
|
||||
addPopulation(1)
|
||||
city.reassignPopulation = true
|
||||
city.shouldReassignPopulation = true
|
||||
city.civ.addNotification("[${city.name}] has grown!", city.location,
|
||||
NotificationCategory.Cities, NotificationIcon.Growth)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class CityTurnManager(val city: City) {
|
||||
if (city.isPuppet) {
|
||||
city.setCityFocus(CityFocus.GoldFocus)
|
||||
city.reassignAllPopulation()
|
||||
} else if (city.reassignPopulation) {
|
||||
} else if (city.shouldReassignPopulation) {
|
||||
city.reassignPopulation() // includes cityStats.update
|
||||
} else
|
||||
city.cityStats.update()
|
||||
@ -77,7 +77,7 @@ class CityTurnManager(val city: City) {
|
||||
demandNewResource()
|
||||
}
|
||||
CityFlags.Resistance.name -> {
|
||||
city.reassignPopulation = true
|
||||
city.shouldReassignPopulation = true
|
||||
city.civ.addNotification(
|
||||
"The resistance in [${city.name}] has ended!",
|
||||
CityAction.withLocation(city), NotificationCategory.General, "StatIcons/Resistance")
|
||||
|
@ -21,7 +21,7 @@ class UnitTurnManager(val unit: MapUnit) {
|
||||
) {
|
||||
val tile = unit.getTile()
|
||||
if (tile.doWorkerTurn(unit))
|
||||
tile.getCity()?.reassignPopulation = true
|
||||
tile.getCity()?.shouldReassignPopulation = true
|
||||
}
|
||||
|
||||
if (!unit.hasUnitMovedThisTurn() && unit.isFortified() && unit.turnsFortified < 2) {
|
||||
|
Reference in New Issue
Block a user