diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 96392da9a0..74e3e3b859 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -690,26 +690,17 @@ class MapUnit { civInfo.addNotification("An enemy [Citadel] has destroyed our [$name]", currentTile.position, Color.RED) // todo - add notification for attacking civ destroy() - } else { - civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED) - } + } else civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED) } } fun matchesCategory(category:String): Boolean { - if (category == type.name) - return true - if (category == name) - return true - - if ((category == "Wounded" || category == "wounded units") && health < 100) - return true - if ((category == "Land" || category == "land units") && type.isLandUnit()) - return true - if ((category == "Water" || category == "water units") && type.isWaterUnit()) - return true - if ((category == "Air" || category == "air units") && type.isAirUnit()) - return true + if (category == type.name) return true + if (category == name) return true + if ((category == "Wounded" || category == "wounded units") && health < 100) return true + if ((category == "Land" || category == "land units") && type.isLandUnit()) return true + if ((category == "Water" || category == "water units") && type.isWaterUnit()) return true + if ((category == "Air" || category == "air units") && type.isAirUnit()) return true return false } diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt b/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt index 186dd72581..5c1516e9f5 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt @@ -51,24 +51,27 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS private fun Popup.addClearCurrentMapButton() { val clearCurrentMapButton = "Clear current map".toTextButton() + clearCurrentMapButton.onClick { - for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) { - val tile = tileGroup.tileInfo - tile.baseTerrain = Constants.ocean - tile.terrainFeature = null - tile.naturalWonder = null - tile.hasBottomRiver=false - tile.hasBottomLeftRiver=false - tile.hasBottomRightRiver=false - tile.resource = null - tile.improvement = null - tile.improvementInProgress = null - tile.roadStatus = RoadStatus.None + YesNoPopup("Are you sure you want to clear the entire map?", { + for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) { + val tile = tileGroup.tileInfo + tile.baseTerrain = Constants.ocean + tile.terrainFeature = null + tile.naturalWonder = null + tile.hasBottomRiver = false + tile.hasBottomLeftRiver = false + tile.hasBottomRightRiver = false + tile.resource = null + tile.improvement = null + tile.improvementInProgress = null + tile.roadStatus = RoadStatus.None - tile.setTransients() + tile.setTransients() - tileGroup.update() - } + tileGroup.update() + } + }, mapEditorScreen).open() } add(clearCurrentMapButton).row() }