diff --git a/android/assets/jsons/Translations.json b/android/assets/jsons/Translations.json index cb2d2c9e..21d6f127 100644 --- a/android/assets/jsons/Translations.json +++ b/android/assets/jsons/Translations.json @@ -4808,6 +4808,8 @@ German:"[civName] hat uns den Krieg erklärt!" } + "[tradeOffer] from [otherCivName] has ended":{} + "[leaderName] of [nation]":{ // e.g. Ramasses of Egypt, Napoleon of France Italian:"[leaderName] dell'Impero [nation]" //es. Ramses II dell'Impero egiziano, Napoleone dell'Impero francese (so it should be [adjective] instead of [nation] German:"[leaderName] von [nation]" diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 149f2c98..a92fa5eb 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -196,9 +196,7 @@ class Battle(val gameInfo:GameInfo) { if(city.cityConstructions.isBuilt("Palace")){ city.cityConstructions.removeBuilding("Palace") if(enemyCiv.isDefeated()) { - for(civ in gameInfo.civilizations) - civ.addNotification("The civilization of [${enemyCiv.civName}] has been destroyed!", null, Color.RED) - enemyCiv.getCivUnits().forEach { it.destroy() } + enemyCiv.destroy() attacker.getCivInfo().popupAlerts.add(PopupAlert(AlertType.Defeated,enemyCiv.civName)) } else if(enemyCiv.cities.isNotEmpty()){ diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index c7ab39f1..c2654700 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -508,5 +508,18 @@ class CivilizationInfo { } } + fun destroy(){ + for(civ in gameInfo.civilizations) + civ.addNotification("The civilization of [$civName] has been destroyed!", null, Color.RED) + getCivUnits().forEach { it.destroy() } + tradeRequests.clear() // if we don't do this then there could be resources taken by "pending" trades forever + for(diplomacyManager in diplomacy.values){ + diplomacyManager.trades.clear() + diplomacyManager.otherCiv().getDiplomacyManager(this).trades.clear() + for(tradeRequest in diplomacyManager.otherCiv().tradeRequests.filter { it.requestingCiv==civName }) + diplomacyManager.otherCiv().tradeRequests.remove(tradeRequest) // it would be really weird to get a trade request from a dead civ + } + } + //endregion }