From e59ad4ff9434c56fa3dfcc6eab13e0e9e7839b3d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 29 Jun 2019 23:56:35 +0300 Subject: [PATCH] Fixed war declaration against civs with a space in their name (e.g. The Ottomans) --- core/src/com/unciv/logic/trade/TradeEvaluation.kt | 4 ++-- core/src/com/unciv/ui/trade/DiplomacyScreen.kt | 8 ++++---- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/com/unciv/logic/trade/TradeEvaluation.kt b/core/src/com/unciv/logic/trade/TradeEvaluation.kt index 825251c8..c153692e 100644 --- a/core/src/com/unciv/logic/trade/TradeEvaluation.kt +++ b/core/src/com/unciv/logic/trade/TradeEvaluation.kt @@ -88,7 +88,7 @@ class TradeEvaluation{ TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { - val nameOfCivToDeclareWarOn = offer.name.split(' ').last() + val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn) val threatToThem = Automation().threatAssessment(civInfo,civToDeclareWarOn) @@ -159,7 +159,7 @@ class TradeEvaluation{ TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { - val nameOfCivToDeclareWarOn = offer.name.split(' ').last() + val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn) val threatToUs = Automation().threatAssessment(civInfo, civToDeclareWarOn) diff --git a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt index bc62a145..059314aa 100644 --- a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt +++ b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt @@ -52,9 +52,8 @@ class DiplomacyScreen:CameraStageBaseScreen() { private fun updateLeftSideTable() { leftSideTable.clear() val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization() - for (civ in UnCivGame.Current.gameInfo.civilizations - .filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) { - if (!currentPlayerCiv.knows(civ)) continue + for (civ in currentPlayerCiv.getKnownCivs() + .filterNot { it.isDefeated() || it.isBarbarianCivilization() }) { val civIndicator = ImageGetter.getNationIndicator(civ.getNation(),100f) @@ -225,7 +224,8 @@ class DiplomacyScreen:CameraStageBaseScreen() { } diplomacyTable.add(demandsButton).row() - diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row() + if(!otherCiv.isPlayerCivilization()) + diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row() val diplomacyModifiersTable = Table() for (modifier in otherCivDiplomacyManager.diplomaticModifiers) { diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 35750aaa..48a3e51d 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -186,7 +186,7 @@ class WorldScreen : CameraStageBaseScreen() { private fun updateDiplomacyButton(civInfo: CivilizationInfo) { diplomacyButtonWrapper.clear() if(civInfo.getKnownCivs() - .filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() } + .filterNot { it.isDefeated() || it.isBarbarianCivilization() } .any()) { displayTutorials("OtherCivEncountered") val btn = TextButton("Diplomacy".tr(), skin)