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!"
if (resource.improvement != null && !tileImprovements.containsKey(resource.improvement!!))
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) {
if (improvement.techRequired != null && !technologies.containsKey(improvement.techRequired!!))
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 (prereq in tech.prerequisites) {

View File

@ -342,7 +342,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val resources = ArrayList<Actor>()
resources.add(getHex(Color.WHITE, getCrossedResource()).apply {
onClick {
tileAction = {it.resource=null}
tileAction = { it.resource = null }
setCurrentHex(getHex(Color.WHITE, getCrossedResource()), "Clear resource")
}
})
@ -350,12 +350,12 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
for (resource in ruleset.tileResources.values) {
val resourceHex = getHex(Color.WHITE, ImageGetter.getResourceImage(resource.name, 40f))
resourceHex.onClick {
tileAction = {it.resource = resource.name}
tileAction = { it.resource = resource.name }
// for the tile image
val tileInfo = TileInfo()
tileInfo.ruleset = mapEditorScreen.ruleset
val terrain = resource.terrainsCanBeFoundOn.first()
val terrain = resource.terrainsCanBeFoundOn.first { ruleset.terrains.containsKey(it) }
val terrainObject = ruleset.terrains[terrain]!!
if (terrainObject.type == TerrainType.TerrainFeature) {
tileInfo.baseTerrain =