Patch ModManager exit to allow deactivating a selected tileset (#4029)

This commit is contained in:
SomeTroglodyte 2021-06-01 19:00:50 +02:00 committed by GitHub
parent 876bdf8f30
commit 084adc3396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -449,17 +449,18 @@ open class TileInfo {
/** Shows important properties of this tile for debugging _only_, it helps to see what you're doing */
override fun toString(): String {
val lineList = arrayListOf("TileInfo @($position)")
val lineList = arrayListOf("TileInfo @$position")
if (!this::baseTerrain.isInitialized) return lineList[0] + ", uninitialized"
if (isCityCenter()) lineList += getCity()!!.name
lineList += baseTerrain
for (terrainFeature in terrainFeatures) lineList += terrainFeature
if (resource != null ) lineList += resource!!
if (resource != null) lineList += resource!!
if (naturalWonder != null) lineList += naturalWonder!!
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.name
if (improvement != null) lineList += improvement!!
if (civilianUnit != null) lineList += civilianUnit!!.name + " - " + civilianUnit!!.civInfo.civName
if (militaryUnit != null) lineList += militaryUnit!!.name + " - " + militaryUnit!!.civInfo.civName
if (isImpassible()) lineList += Constants.impassable
if (this::baseTerrainObject.isInitialized && isImpassible()) lineList += Constants.impassable
return lineList.joinToString()
}

View File

@ -104,7 +104,18 @@ class ModManagementScreen: PickerScreen(disableScroll = true) {
init {
setDefaultCloseAction(MainMenuScreen())
//setDefaultCloseAction(screen) // this would initialize the new MainMenuScreen immediately
val closeAction = {
val tileSets = ImageGetter.getAvailableTilesets()
if (game.settings.tileSet !in tileSets) {
game.settings.tileSet = tileSets.first()
}
game.setScreen(MainMenuScreen())
dispose()
}
closeButton.onClick(closeAction)
onBackButtonClicked(closeAction)
refreshInstalledModTable()
// Header row