chore: More civinfo cleanup

This commit is contained in:
Yair Morgenstern
2023-01-18 16:07:04 +02:00
parent a5a50a30e1
commit 1b497c6941
4 changed files with 11 additions and 12 deletions

View File

@ -30,7 +30,6 @@ import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.TileInfo
import com.unciv.logic.map.UnitMovementAlgorithms
import com.unciv.logic.trade.TradeRequest
import com.unciv.models.Counter
import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.Policy
import com.unciv.models.ruleset.Victory
@ -954,12 +953,6 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
}
}
fun getGreatPersonPointsForNextTurn(): Counter<String> {
val greatPersonPoints = Counter<String>()
for (city in cities) greatPersonPoints.add(city.getGreatPersonPoints())
return greatPersonPoints
}
/**
* @returns whether units of this civilization can pass through the tiles owned by [otherCiv],
* considering only civ-wide filters.

View File

@ -59,8 +59,8 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
return null
}
fun addGreatPersonPoints(greatPersonPointsForTurn: Counter<String>) {
greatPersonPointsCounter.add(greatPersonPointsForTurn)
fun addGreatPersonPoints() {
greatPersonPointsCounter.add(getGreatPersonPointsForNextTurn())
}
@ -73,4 +73,10 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
else greatPeople.toHashSet()
}
fun getGreatPersonPointsForNextTurn(): Counter<String> {
val greatPersonPoints = Counter<String>()
for (city in civInfo.cities) greatPersonPoints.add(city.getGreatPersonPoints())
return greatPersonPoints
}
}

View File

@ -249,8 +249,8 @@ class TurnManager(val civInfo: CivilizationInfo) {
civInfo.espionageManager.endTurn()
if (civInfo.isMajorCiv())
civInfo.greatPeople.addGreatPersonPoints(civInfo.getGreatPersonPointsForNextTurn()) // City-states don't get great people!
if (civInfo.isMajorCiv()) // City-states don't get great people!
civInfo.greatPeople.addGreatPersonPoints()
// To handle tile's owner issue (#8246), we need to run being razed city first.
for (city in sequence {

View File

@ -158,7 +158,7 @@ class StatsOverviewTab(
add("Points per turn".toLabel()).row()
val greatPersonPoints = viewingPlayer.greatPeople.greatPersonPointsCounter
val greatPersonPointsPerTurn = viewingPlayer.getGreatPersonPointsForNextTurn()
val greatPersonPointsPerTurn = viewingPlayer.greatPeople.getGreatPersonPointsForNextTurn()
val pointsToGreatPerson = viewingPlayer.greatPeople.getPointsRequiredForGreatPerson()
for ((greatPerson, points) in greatPersonPoints) {
add(greatPerson.toLabel()).left()