mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Fixed a bug where maps created before the split PR could no longer be opened after (#5651)
This commit is contained in:
parent
ac2bc3a404
commit
5cf5e13ffb
@ -142,7 +142,7 @@ class MapParameters {
|
||||
|
||||
/** This is used mainly for the map editor, so you can continue editing a map under the same ruleset you started with */
|
||||
var mods = LinkedHashSet<String>()
|
||||
var baseRuleset = BaseRuleset.Civ_V_Vanilla.name // Hardcoded as the Rulesetcache is not yet initialized when starting up
|
||||
var baseRuleset = BaseRuleset.Civ_V_GnK.fullName // Hardcoded as the Rulesetcache is not yet initialized when starting up
|
||||
|
||||
/** Unciv Version of creation for support cases */
|
||||
var createdWithVersion = ""
|
||||
|
@ -66,8 +66,13 @@ class SaveAndLoadMapScreen(mapToSave: TileMap?, save:Boolean = false, previousSc
|
||||
}
|
||||
try {
|
||||
val map = MapSaver.loadMap(chosenMap!!, checkSizeErrors = false)
|
||||
|
||||
|
||||
val missingMods = map.mapParameters.mods.filter { it !in RulesetCache }.toMutableList()
|
||||
// [TEMPORARY] conversion of old maps with a base ruleset contained in the mods
|
||||
val newBaseRuleset = map.mapParameters.mods.filter { it !in missingMods }.firstOrNull { RulesetCache[it]!!.modOptions.isBaseRuleset }
|
||||
if (newBaseRuleset != null) map.mapParameters.baseRuleset = newBaseRuleset
|
||||
//
|
||||
|
||||
if (map.mapParameters.baseRuleset !in RulesetCache) missingMods += map.mapParameters.baseRuleset
|
||||
|
||||
if (missingMods.isNotEmpty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user