mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Deprecation of old components - ConstructionFilter, Ruleset.maxXpFromBarbarians, GameParameters.gameSpeed
This commit is contained in:
parent
5a58d8c39c
commit
a46870c862
@ -142,10 +142,6 @@ object BackwardCompatibility {
|
|||||||
/** Move max XP from barbarians to new home */
|
/** Move max XP from barbarians to new home */
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
fun ModOptions.updateDeprecations() {
|
fun ModOptions.updateDeprecations() {
|
||||||
if (maxXPfromBarbarians != 30) {
|
|
||||||
constants.maxXPfromBarbarians = maxXPfromBarbarians
|
|
||||||
maxXPfromBarbarians = 30
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -175,14 +171,6 @@ object BackwardCompatibility {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
fun GameInfo.convertOldGameSpeed() {
|
|
||||||
if (gameParameters.gameSpeed != "" && gameParameters.gameSpeed in ruleset.speeds.keys) {
|
|
||||||
gameParameters.speed = gameParameters.gameSpeed
|
|
||||||
gameParameters.gameSpeed = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun GameInfo.migrateToTileHistory() {
|
fun GameInfo.migrateToTileHistory() {
|
||||||
if (historyStartTurn >= 0) return
|
if (historyStartTurn >= 0) return
|
||||||
for (tile in getCities().flatMap { it.getTiles() }) {
|
for (tile in getCities().flatMap { it.getTiles() }) {
|
||||||
|
@ -4,7 +4,6 @@ import com.unciv.Constants
|
|||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.UncivGame.Version
|
import com.unciv.UncivGame.Version
|
||||||
import com.unciv.logic.BackwardCompatibility.convertFortify
|
import com.unciv.logic.BackwardCompatibility.convertFortify
|
||||||
import com.unciv.logic.BackwardCompatibility.convertOldGameSpeed
|
|
||||||
import com.unciv.logic.BackwardCompatibility.guaranteeUnitPromotions
|
import com.unciv.logic.BackwardCompatibility.guaranteeUnitPromotions
|
||||||
import com.unciv.logic.BackwardCompatibility.migrateToTileHistory
|
import com.unciv.logic.BackwardCompatibility.migrateToTileHistory
|
||||||
import com.unciv.logic.BackwardCompatibility.removeMissingModReferences
|
import com.unciv.logic.BackwardCompatibility.removeMissingModReferences
|
||||||
@ -509,8 +508,6 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
|
|
||||||
removeMissingModReferences()
|
removeMissingModReferences()
|
||||||
|
|
||||||
convertOldGameSpeed()
|
|
||||||
|
|
||||||
for (baseUnit in ruleset.units.values)
|
for (baseUnit in ruleset.units.values)
|
||||||
baseUnit.ruleset = ruleset
|
baseUnit.ruleset = ruleset
|
||||||
|
|
||||||
@ -586,10 +583,6 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
|
|
||||||
cityInfo.cityStats.update()
|
cityInfo.cityStats.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (civInfo.hasEverOwnedOriginalCapital == null) {
|
|
||||||
civInfo.hasEverOwnedOriginalCapital = civInfo.cities.any { it.isOriginalCapital }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spaceResources.clear()
|
spaceResources.clear()
|
||||||
|
@ -195,10 +195,7 @@ class Civilization : IsPartOfGameInfoSerialization {
|
|||||||
var lastSeenImprovement = HashMapVector2<String>()
|
var lastSeenImprovement = HashMapVector2<String>()
|
||||||
|
|
||||||
// To correctly determine "game over" condition as clarified in #4707
|
// To correctly determine "game over" condition as clarified in #4707
|
||||||
// Nullable type meant to be deprecated and converted to non-nullable,
|
var hasEverOwnedOriginalCapital: Boolean = false
|
||||||
// default false once we no longer want legacy save-game compatibility
|
|
||||||
// This parameter means they owned THEIR OWN capital btw, not other civs'.
|
|
||||||
var hasEverOwnedOriginalCapital: Boolean? = null
|
|
||||||
|
|
||||||
val passableImpassables = HashSet<String>() // For Carthage-like uniques
|
val passableImpassables = HashSet<String>() // For Carthage-like uniques
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ class GameParameters : IsPartOfGameInfoSerialization { // Default values are the
|
|||||||
var difficulty = "Prince"
|
var difficulty = "Prince"
|
||||||
var speed = Speed.DEFAULT
|
var speed = Speed.DEFAULT
|
||||||
|
|
||||||
@Deprecated("Since 4.1.11")
|
|
||||||
var gameSpeed = ""
|
|
||||||
var randomNumberOfPlayers = false
|
var randomNumberOfPlayers = false
|
||||||
var minNumberOfPlayers = 3
|
var minNumberOfPlayers = 3
|
||||||
var maxNumberOfPlayers = 3
|
var maxNumberOfPlayers = 3
|
||||||
|
@ -59,9 +59,6 @@ class ModOptions : IHasUniques {
|
|||||||
var modSize = 0
|
var modSize = 0
|
||||||
var topics = mutableListOf<String>()
|
var topics = mutableListOf<String>()
|
||||||
|
|
||||||
@Deprecated("As of 3.18.15")
|
|
||||||
var maxXPfromBarbarians = 30
|
|
||||||
|
|
||||||
override var uniques = ArrayList<String>()
|
override var uniques = ArrayList<String>()
|
||||||
|
|
||||||
// If these two are delegated with "by lazy", the mod download process crashes and burns
|
// If these two are delegated with "by lazy", the mod download process crashes and burns
|
||||||
|
@ -413,11 +413,6 @@ class RulesetValidator(val ruleset: Ruleset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
if (ruleset.modOptions.maxXPfromBarbarians != 30) {
|
|
||||||
lines.add("maxXPfromBarbarians is moved to the constants object, instead use: \nconstants: {\n maxXPfromBarbarians: ${ruleset.modOptions.maxXPfromBarbarians},\n}", RulesetErrorSeverity.Warning)
|
|
||||||
}
|
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,19 +235,6 @@ enum class UniqueParameterType(
|
|||||||
parameterText != "All" && getErrorSeverity(parameterText, ruleset) == null
|
parameterText != "All" && getErrorSeverity(parameterText, ruleset) == null
|
||||||
},
|
},
|
||||||
|
|
||||||
/** [UniqueType.PercentProductionConstructions], [UniqueType.PercentProductionConstructionsCities] */
|
|
||||||
@Deprecated("as of 3.17.10 - removed 3.18.5")
|
|
||||||
ConstructionFilter("constructionFilter", "Spaceship Part") {
|
|
||||||
override fun getErrorSeverity(
|
|
||||||
parameterText: String,
|
|
||||||
ruleset: Ruleset
|
|
||||||
): UniqueType.UniqueComplianceErrorSeverity? {
|
|
||||||
if (BuildingFilter.getErrorSeverity(parameterText, ruleset) == null) return null
|
|
||||||
if (BaseUnitFilter.getErrorSeverity(parameterText, ruleset) == null) return null
|
|
||||||
return UniqueType.UniqueComplianceErrorSeverity.WarningOnly
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/** Implemented by [PopulationManager.getPopulationFilterAmount][com.unciv.logic.city.CityPopulationManager.getPopulationFilterAmount] */
|
/** Implemented by [PopulationManager.getPopulationFilterAmount][com.unciv.logic.city.CityPopulationManager.getPopulationFilterAmount] */
|
||||||
PopulationFilter("populationFilter", "Followers of this Religion", null, "Population Filters") {
|
PopulationFilter("populationFilter", "Followers of this Religion", null, "Population Filters") {
|
||||||
private val knownValues = setOf("Population", "Specialists", "Unemployed", "Followers of the Majority Religion", "Followers of this Religion")
|
private val knownValues = setOf("Population", "Specialists", "Unemployed", "Followers of the Majority Religion", "Followers of this Religion")
|
||||||
|
@ -15,8 +15,8 @@ import com.unciv.models.stats.Stat
|
|||||||
import com.unciv.ui.components.extensions.filterAndLogic
|
import com.unciv.ui.components.extensions.filterAndLogic
|
||||||
import com.unciv.ui.components.extensions.getNeedMoreAmountString
|
import com.unciv.ui.components.extensions.getNeedMoreAmountString
|
||||||
import com.unciv.ui.components.extensions.toPercent
|
import com.unciv.ui.components.extensions.toPercent
|
||||||
import com.unciv.ui.screens.civilopediascreen.FormattedLine
|
|
||||||
import com.unciv.ui.objectdescriptions.BaseUnitDescriptions
|
import com.unciv.ui.objectdescriptions.BaseUnitDescriptions
|
||||||
|
import com.unciv.ui.screens.civilopediascreen.FormattedLine
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
// This is BaseUnit because Unit is already a base Kotlin class and to avoid mixing the two up
|
// This is BaseUnit because Unit is already a base Kotlin class and to avoid mixing the two up
|
||||||
@ -293,8 +293,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
|||||||
"non-air" -> !movesLikeAirUnits()
|
"non-air" -> !movesLikeAirUnits()
|
||||||
|
|
||||||
"Nuclear Weapon" -> isNuclearWeapon()
|
"Nuclear Weapon" -> isNuclearWeapon()
|
||||||
// "Great" should be deprecated, replaced by "Great Person".
|
"Great Person" -> isGreatPerson()
|
||||||
"Great Person", "Great" -> isGreatPerson()
|
|
||||||
"Religious" -> hasUnique(UniqueType.ReligiousUnit)
|
"Religious" -> hasUnique(UniqueType.ReligiousUnit)
|
||||||
else -> {
|
else -> {
|
||||||
if (getType().matchesFilter(filter)) return true
|
if (getType().matchesFilter(filter)) return true
|
||||||
|
@ -104,6 +104,7 @@ class BasicTests {
|
|||||||
fun uniqueTypesHaveNoUnknownParameters() {
|
fun uniqueTypesHaveNoUnknownParameters() {
|
||||||
var noUnknownParameters = true
|
var noUnknownParameters = true
|
||||||
for (uniqueType in UniqueType.values()) {
|
for (uniqueType in UniqueType.values()) {
|
||||||
|
if (uniqueType.getDeprecationAnnotation()!=null) continue
|
||||||
for (entry in uniqueType.parameterTypeMap.withIndex()) {
|
for (entry in uniqueType.parameterTypeMap.withIndex()) {
|
||||||
for (paramType in entry.value) {
|
for (paramType in entry.value) {
|
||||||
if (paramType == UniqueParameterType.Unknown) {
|
if (paramType == UniqueParameterType.Unknown) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user