mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 14:15:15 +07:00
Resolved #1835 - game no longer crashes when losing alliance with a city-state due to it being captured
This commit is contained in:
parent
24c3bdc564
commit
0f26671bcf
@ -542,15 +542,19 @@ class CivilizationInfo {
|
||||
val oldAllyName = allyCivName
|
||||
allyCivName = newAllyName
|
||||
|
||||
// If the city-state is captured by a civ, it stops being the ally of the civ it was previously an ally of.
|
||||
// This means that it will NOT HAVE a capital at that time, so if we run getCapital we'll get a crash!
|
||||
val capitalLocation = if(cities.isNotEmpty()) getCapital().location else null
|
||||
|
||||
if (newAllyName != "") {
|
||||
val newAllyCiv = gameInfo.getCivilization(newAllyName)
|
||||
newAllyCiv.addNotification("We have allied with [${civName}].", getCapital().location, Color.GREEN)
|
||||
newAllyCiv.addNotification("We have allied with [${civName}].", capitalLocation, Color.GREEN)
|
||||
newAllyCiv.updateViewableTiles()
|
||||
newAllyCiv.updateDetailedCivResources()
|
||||
}
|
||||
if (oldAllyName != "") {
|
||||
val oldAllyCiv = gameInfo.getCivilization(oldAllyName)
|
||||
oldAllyCiv.addNotification("We have lost alliance with [${civName}].", getCapital().location, Color.RED)
|
||||
oldAllyCiv.addNotification("We have lost alliance with [${civName}].", capitalLocation, Color.RED)
|
||||
oldAllyCiv.updateViewableTiles()
|
||||
oldAllyCiv.updateDetailedCivResources()
|
||||
}
|
||||
|
@ -226,8 +226,9 @@ class DiplomacyManager() {
|
||||
* This includes friendly and allied city-states and the open border treaties.
|
||||
*/
|
||||
fun isConsideredAllyTerritory(): Boolean {
|
||||
return (hasOpenBorders)
|
||||
|| (civInfo.isCityState() && relationshipLevel() >= RelationshipLevel.Friend)
|
||||
if(civInfo.isCityState() && relationshipLevel() >= RelationshipLevel.Friend)
|
||||
return true
|
||||
return hasOpenBorders
|
||||
}
|
||||
//endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user