Fix spies being gained in non espionage games (#7661)

* Handfull of comment questions, small refactorings

* Code changes

* Reworded a unique, removed a file

* Added spy names for all nations, minor consistency change

* Removed debug output

* Added an empty constructor so gdx can reconstruct it

* No spies gained when espionage is disabled

* Added missing function
This commit is contained in:
Xander Lenstra
2022-08-14 17:37:39 +02:00
committed by GitHub
parent 87c1662462
commit b1727f9360
3 changed files with 10 additions and 1 deletions

View File

@ -212,6 +212,10 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
return !religionDisabledByRuleset && gameParameters.religionEnabled
}
fun isEspionageEnabled(): Boolean {
return gameParameters.espionageEnabled
}
private fun getEquivalentTurn(): Int {
val totalTurns = speed.numTotalTurns()
val startPercent = ruleSet.eras[gameParameters.startingEra]!!.startPercent
@ -540,6 +544,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
//endregion
fun asPreview() = GameInfoPreview(this)
}
/**

View File

@ -479,6 +479,7 @@ object UniqueTriggerActivation {
OneTimeGlobalSpiesWhenEnteringEra -> {
if (!civInfo.isMajorCiv()) return false
if (!civInfo.gameInfo.isEspionageEnabled()) return false
val currentEra = civInfo.getEra().name
for (otherCiv in civInfo.gameInfo.getAliveMajorCivs()) {
if (currentEra !in otherCiv.espionageManager.erasSpyEarnedFor) {