Game can handle mods removing tile features between versions

This commit is contained in:
Yair Morgenstern
2021-02-06 19:42:14 +02:00
parent 4d0f66e159
commit 60fe8fc36b

View File

@ -331,6 +331,8 @@ class GameInfo {
// So we remove them so the game doesn't crash when it tries to access them.
private fun removeMissingModReferences() {
for (tile in tileMap.values) {
if (tile.terrainFeature!=null && !ruleSet.terrains.containsKey(tile.terrainFeature!!))
tile.terrainFeature = null
if (tile.resource != null && !ruleSet.tileResources.containsKey(tile.resource!!))
tile.resource = null
if (tile.improvement != null && !ruleSet.tileImprovements.containsKey(tile.improvement!!)