Fixed units not being removed from open borders area after declaring war (#4584)

This commit is contained in:
Xander Lenstra 2021-07-21 09:31:13 +02:00 committed by GitHub
parent 167d9705f7
commit 92c4e4e083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -505,8 +505,6 @@ class DiplomacyManager() {
/** Everything that happens to both sides equally when war is delcared by one side on the other */ /** Everything that happens to both sides equally when war is delcared by one side on the other */
private fun onWarDeclared() { private fun onWarDeclared() {
diplomaticStatus = DiplomaticStatus.War
// Cancel all trades. // Cancel all trades.
for (trade in trades) for (trade in trades)
for (offer in trade.theirOffers.filter { it.duration > 0 }) for (offer in trade.theirOffers.filter { it.duration > 0 })
@ -514,6 +512,8 @@ class DiplomacyManager() {
trades.clear() trades.clear()
updateHasOpenBorders() updateHasOpenBorders()
diplomaticStatus = DiplomaticStatus.War
removeModifier(DiplomaticModifiers.YearsOfPeace) removeModifier(DiplomaticModifiers.YearsOfPeace)
setFlag(DiplomacyFlags.DeclinedPeace, 10)/// AI won't propose peace for 10 turns setFlag(DiplomacyFlags.DeclinedPeace, 10)/// AI won't propose peace for 10 turns
setFlag(DiplomacyFlags.DeclaredWar, 10) // AI won't agree to trade for 10 turns setFlag(DiplomacyFlags.DeclaredWar, 10) // AI won't agree to trade for 10 turns
@ -526,7 +526,7 @@ class DiplomacyManager() {
onWarDeclared() onWarDeclared()
otherCivDiplomacy.onWarDeclared() otherCivDiplomacy.onWarDeclared()
otherCiv.addNotification("[${civInfo.civName}] has declared war on us!", NotificationIcon.War, civInfo.civName) otherCiv.addNotification("[${civInfo.civName}] has declared war on us!", NotificationIcon.War, civInfo.civName)
otherCiv.popupAlerts.add(PopupAlert(AlertType.WarDeclaration, civInfo.civName)) otherCiv.popupAlerts.add(PopupAlert(AlertType.WarDeclaration, civInfo.civName))
@ -582,8 +582,7 @@ class DiplomacyManager() {
} }
} }
if (otherCiv.isCityState()) if (otherCiv.isCityState()) {
{
for (thirdCiv in otherCiv.getProtectorCivs()) { for (thirdCiv in otherCiv.getProtectorCivs()) {
if (thirdCiv.knows(civInfo) if (thirdCiv.knows(civInfo)
&& thirdCiv.getDiplomacyManager(civInfo).canDeclareWar()) { && thirdCiv.getDiplomacyManager(civInfo).canDeclareWar()) {