Fixed some more silly bugs caused by badly configured mods

This commit is contained in:
Yair Morgenstern 2020-10-24 22:21:09 +03:00
parent 88eab17e9e
commit 2a82482d05
2 changed files with 15 additions and 3 deletions

View File

@ -258,12 +258,24 @@ class Ruleset {
lines += "${resource.name} revealed by tech ${resource.revealedBy} which does not exist!" lines += "${resource.name} revealed by tech ${resource.revealedBy} which does not exist!"
if (resource.improvement != null && !tileImprovements.containsKey(resource.improvement!!)) if (resource.improvement != null && !tileImprovements.containsKey(resource.improvement!!))
lines += "${resource.name} improved by improvement ${resource.improvement} which does not exist!" lines += "${resource.name} improved by improvement ${resource.improvement} which does not exist!"
for(terrain in resource.terrainsCanBeFoundOn)
if(!terrains.containsKey(terrain))
lines += "${resource.name} can be found on terrain $terrain which does not exist!"
} }
for (improvement in tileImprovements.values) { for (improvement in tileImprovements.values) {
if (improvement.techRequired != null && !technologies.containsKey(improvement.techRequired!!)) if (improvement.techRequired != null && !technologies.containsKey(improvement.techRequired!!))
lines += "${improvement.name} requires tech ${improvement.techRequired} which does not exist!" lines += "${improvement.name} requires tech ${improvement.techRequired} which does not exist!"
for (terrain in improvement.terrainsCanBeBuiltOn)
if (!terrains.containsKey(terrain))
lines += "${improvement.name} can be built on terrain $terrain which does not exist!"
} }
//
// for(terrain in terrains.values){
// for(baseTerrain in terrain.occursOn)
// if (!terrains.containsKey(baseTerrain))
// lines += "${improvement.name} can be built on terrain $terrain which does not exist!"
// }
for (tech in technologies.values) { for (tech in technologies.values) {
for (prereq in tech.prerequisites) { for (prereq in tech.prerequisites) {

View File

@ -355,7 +355,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
// for the tile image // for the tile image
val tileInfo = TileInfo() val tileInfo = TileInfo()
tileInfo.ruleset = mapEditorScreen.ruleset tileInfo.ruleset = mapEditorScreen.ruleset
val terrain = resource.terrainsCanBeFoundOn.first() val terrain = resource.terrainsCanBeFoundOn.first { ruleset.terrains.containsKey(it) }
val terrainObject = ruleset.terrains[terrain]!! val terrainObject = ruleset.terrains[terrain]!!
if (terrainObject.type == TerrainType.TerrainFeature) { if (terrainObject.type == TerrainType.TerrainFeature) {
tileInfo.baseTerrain = tileInfo.baseTerrain =