mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 13:18:56 +07:00
Moddable game speed backwards compatibility (#7212)
* Move GameSpeed definition to JSON files * Minor cleanup and some corrections * Round down tribute gold to match old when statement * Small variable name changes * Some typos * Reduce number of speed modifiers plus code improvements * Catch missing game speed * Found a better place for the check * More tweaks * Added a startYear mod constant and some tweaks * Cleanup old GameSpeed file references * Fix tests * Add game speeds civilopedia page * Remove one last todo * Fix translation * New icon for game speeds * More game speed modifiers * Fix error * Update Speeds.json files and move tutorial to docs * Rename GameSpeed class to Speed * Rename GameSpeed -> Speed and other reviews * Forgot a file * Add start year to civilopedia * Remove decimal from default starting years * Fix backwards compatibility * Unused import Co-authored-by: OptimizedForDensity <>
This commit is contained in:

committed by
GitHub

parent
9683e27526
commit
4955d35efb
@ -218,4 +218,12 @@ object BackwardCompatibility {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun GameInfo.convertOldGameSpeed() {
|
||||
if (gameParameters.gameSpeed != "" && gameParameters.gameSpeed in ruleSet.speeds.keys) {
|
||||
gameParameters.speed = gameParameters.gameSpeed
|
||||
gameParameters.gameSpeed = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.unciv.logic
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.BackwardCompatibility.convertFortify
|
||||
import com.unciv.logic.BackwardCompatibility.convertOldGameSpeed
|
||||
import com.unciv.utils.debug
|
||||
import com.unciv.logic.BackwardCompatibility.guaranteeUnitPromotions
|
||||
import com.unciv.logic.BackwardCompatibility.migrateBarbarianCamps
|
||||
@ -399,6 +400,8 @@ class GameInfo {
|
||||
|
||||
updateGreatGeneralUniques()
|
||||
|
||||
convertOldGameSpeed()
|
||||
|
||||
for (baseUnit in ruleSet.units.values)
|
||||
baseUnit.ruleset = ruleSet
|
||||
|
||||
|
@ -11,6 +11,9 @@ enum class BaseRuleset(val fullName:String){
|
||||
class GameParameters { // Default values are the default new game
|
||||
var difficulty = "Prince"
|
||||
var speed = Speed.DEFAULT
|
||||
|
||||
@Deprecated("Since 4.1.11")
|
||||
var gameSpeed = ""
|
||||
var players = ArrayList<Player>().apply {
|
||||
add(Player().apply { playerType = PlayerType.Human })
|
||||
for (i in 1..3) add(Player())
|
||||
|
Reference in New Issue
Block a user