BackwardCompatibility

object BackwardCompatibility

Container for all temporarily used code managing transitions from deprecated elements to their replacements.

Please place all such code here and call it only from GameInfo.setTransients. Functions are allowed to remain once no longer used if you think they might serve as template for similar usecases in the future. Please comment sufficiently :)

Functions

changeBuildingNameIfNotInRuleset
Link copied to clipboard
private fun changeBuildingNameIfNotInRuleset(ruleSet: Ruleset, cityConstructions: CityConstructions, oldBuildingName: String, newBuildingName: String)

Replaces all occurrences of oldBuildingName in cityConstructions with newBuildingName if the former is not contained in the ruleset.

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
removeMissingModReferences
Link copied to clipboard
fun GameInfo.removeMissingModReferences()

Mods can change, leading to things on the map that are no longer defined in the mod. This function removes them so the game doesn't crash when it tries to access them.

replaceDiplomacyFlag
Link copied to clipboard
fun GameInfo.replaceDiplomacyFlag(old: DiplomacyFlags, new: DiplomacyFlags)

Replace a deprecated DiplomacyFlags instance

replaceUpdatedTechName
Link copied to clipboard
private fun TechManager.replaceUpdatedTechName(oldTechName: String, newTechName: String)

Replace a changed tech name

toString
Link copied to clipboard
open fun toString(): String

Sources

jvm source
Link copied to clipboard