mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-29 22:29:15 +07:00
Fix election crash (#11731)
* Fixed the election crash * Added better comments
This commit is contained in:
@ -63,11 +63,6 @@ class CityStateFunctions(val civInfo: Civilization) {
|
||||
civInfo.cityStateUniqueUnit = possibleUnits.random().name
|
||||
}
|
||||
|
||||
// Set turns to elections to a random number so not every city-state has the same election date
|
||||
if (civInfo.gameInfo.isEspionageEnabled()) {
|
||||
civInfo.addFlag(CivFlags.TurnsTillCityStateElection.name, Random.nextInt(civInfo.gameInfo.ruleset.modOptions.constants.cityStateElectionTurns + 1))
|
||||
}
|
||||
|
||||
// TODO: Return false if attempting to put a religious city-state in a game without religion
|
||||
|
||||
return true
|
||||
|
@ -262,8 +262,9 @@ class TurnManager(val civInfo: Civilization) {
|
||||
|
||||
if (civInfo.isCityState()) {
|
||||
civInfo.questManager.endTurn()
|
||||
// Todo: Remove this later
|
||||
// The purpouse of this addition is to migrate the old election system to the new flag system
|
||||
|
||||
// Set turns to elections to a random number so not every city-state has the same election date
|
||||
// May be called at game start or when migrating a game from an older version
|
||||
if (civInfo.gameInfo.isEspionageEnabled() && !civInfo.hasFlag(CivFlags.TurnsTillCityStateElection.name)) {
|
||||
civInfo.addFlag(CivFlags.TurnsTillCityStateElection.name, Random.nextInt(civInfo.gameInfo.ruleset.modOptions.constants.cityStateElectionTurns + 1))
|
||||
}
|
||||
|
Reference in New Issue
Block a user