File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
core/src/com/unciv/logic/civilization Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -542,15 +542,19 @@ class CivilizationInfo {
542542 val oldAllyName = allyCivName
543543 allyCivName = newAllyName
544544
545+ // If the city-state is captured by a civ, it stops being the ally of the civ it was previously an ally of.
546+ // This means that it will NOT HAVE a capital at that time, so if we run getCapital we'll get a crash!
547+ val capitalLocation = if (cities.isNotEmpty()) getCapital().location else null
548+
545549 if (newAllyName != " " ) {
546550 val newAllyCiv = gameInfo.getCivilization(newAllyName)
547- newAllyCiv.addNotification(" We have allied with [${civName} ]." , getCapital().location , Color .GREEN )
551+ newAllyCiv.addNotification(" We have allied with [${civName} ]." , capitalLocation , Color .GREEN )
548552 newAllyCiv.updateViewableTiles()
549553 newAllyCiv.updateDetailedCivResources()
550554 }
551555 if (oldAllyName != " " ) {
552556 val oldAllyCiv = gameInfo.getCivilization(oldAllyName)
553- oldAllyCiv.addNotification(" We have lost alliance with [${civName} ]." , getCapital().location , Color .RED )
557+ oldAllyCiv.addNotification(" We have lost alliance with [${civName} ]." , capitalLocation , Color .RED )
554558 oldAllyCiv.updateViewableTiles()
555559 oldAllyCiv.updateDetailedCivResources()
556560 }
Original file line number Diff line number Diff line change @@ -226,8 +226,9 @@ class DiplomacyManager() {
226226 * This includes friendly and allied city-states and the open border treaties.
227227 */
228228 fun isConsideredAllyTerritory (): Boolean {
229- return (hasOpenBorders)
230- || (civInfo.isCityState() && relationshipLevel() >= RelationshipLevel .Friend )
229+ if (civInfo.isCityState() && relationshipLevel() >= RelationshipLevel .Friend )
230+ return true
231+ return hasOpenBorders
231232 }
232233 // endregion
233234
You can’t perform that action at this time.
0 commit comments