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.TileInfo
import com.unciv.logic.map.UnitMovementAlgorithms import com.unciv.logic.map.UnitMovementAlgorithms
import com.unciv.logic.trade.TradeRequest import com.unciv.logic.trade.TradeRequest
import com.unciv.models.Counter
import com.unciv.models.ruleset.Building import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.Policy import com.unciv.models.ruleset.Policy
import com.unciv.models.ruleset.Victory 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], * @returns whether units of this civilization can pass through the tiles owned by [otherCiv],
* considering only civ-wide filters. * considering only civ-wide filters.

View File

@ -59,8 +59,8 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
return null return null
} }
fun addGreatPersonPoints(greatPersonPointsForTurn: Counter<String>) { fun addGreatPersonPoints() {
greatPersonPointsCounter.add(greatPersonPointsForTurn) greatPersonPointsCounter.add(getGreatPersonPointsForNextTurn())
} }
@ -73,4 +73,10 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
else greatPeople.toHashSet() 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() civInfo.espionageManager.endTurn()
if (civInfo.isMajorCiv()) if (civInfo.isMajorCiv()) // City-states don't get great people!
civInfo.greatPeople.addGreatPersonPoints(civInfo.getGreatPersonPointsForNextTurn()) // 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. // To handle tile's owner issue (#8246), we need to run being razed city first.
for (city in sequence { for (city in sequence {

View File

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