Fixed tests failing due to removing "crutches"

This commit is contained in:
Yair Morgenstern
2022-11-20 00:24:59 +02:00
parent 933131084b
commit 61b98120a8
2 changed files with 19 additions and 7 deletions

View File

@ -479,6 +479,12 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
// the nation of their civilization when setting transients // the nation of their civilization when setting transients
for (civInfo in civilizations) civInfo.gameInfo = this for (civInfo in civilizations) civInfo.gameInfo = this
for (civInfo in civilizations) civInfo.setNationTransient() for (civInfo in civilizations) civInfo.setNationTransient()
// must be done before updating tileMap, since unit uniques depend on civ uniques depend on allied city-state uniques depend on diplomacy
for (civInfo in civilizations)
for (diplomacyManager in civInfo.diplomacy.values) {
diplomacyManager.civInfo = civInfo
diplomacyManager.updateHasOpenBorders()
}
tileMap.setTransients(ruleSet) tileMap.setTransients(ruleSet)
@ -491,12 +497,6 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
for (religion in religions.values) religion.setTransients(this) for (religion in religions.values) religion.setTransients(this)
// must be done before updating tech manager bools, since that depends on allied city-states
for (civInfo in civilizations)
for (diplomacyManager in civInfo.diplomacy.values) {
diplomacyManager.civInfo = civInfo
diplomacyManager.updateHasOpenBorders()
}
for (civInfo in civilizations) civInfo.setTransients() for (civInfo in civilizations) civInfo.setTransients()
for (civInfo in civilizations) { for (civInfo in civilizations) {

View File

@ -15,7 +15,16 @@ import com.unciv.logic.map.TileMap
import com.unciv.models.Religion import com.unciv.models.Religion
import com.unciv.models.metadata.BaseRuleset import com.unciv.models.metadata.BaseRuleset
import com.unciv.models.metadata.GameSettings import com.unciv.models.metadata.GameSettings
import com.unciv.models.ruleset.* import com.unciv.models.ruleset.Belief
import com.unciv.models.ruleset.BeliefType
import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.IRulesetObject
import com.unciv.models.ruleset.Nation
import com.unciv.models.ruleset.Policy
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.ruleset.Specialist
import com.unciv.models.ruleset.Speed
import com.unciv.models.ruleset.tile.TileImprovement import com.unciv.models.ruleset.tile.TileImprovement
import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.ruleset.unit.BaseUnit import com.unciv.models.ruleset.unit.BaseUnit
@ -109,6 +118,9 @@ class TestGame {
civInfo.civName = nation.name civInfo.civName = nation.name
if (isPlayer) civInfo.playerType = PlayerType.Human if (isPlayer) civInfo.playerType = PlayerType.Human
civInfo.setTransients() civInfo.setTransients()
// Add 1 tech to the player so the era is computed correctly
civInfo.tech.addTechnology(ruleset.technologies.values.minBy { it.era() }.name)
if (cityState != null) { if (cityState != null) {
civInfo.cityStateFunctions.initCityState(ruleset, "Ancient era", emptyList()) civInfo.cityStateFunctions.initCityState(ruleset, "Ancient era", emptyList())
} }