Added notification when cities are connected to the capital

This commit is contained in:
Yair Morgenstern 2019-10-16 00:40:37 +03:00
parent 556ba11bba
commit ecc32365f5
4 changed files with 14 additions and 4 deletions

View file

@ -535,6 +535,9 @@
Simplified_Chinese:"真是不知死活![civName]竟然敢谴责我们!"
}
"[cityName] has been connected to your capital!":{
}
// Trade
"[civName] has accepted your trade request":{
Italian:"[civName] ha accettato la nostra offerta commerciale."

View file

@ -243,7 +243,7 @@ class GameInfo {
// Since this depends on the cities of ALL civilizations,
// we need to wait until we've set the transients of all the cities before we can run this.
// Hence why it's not in CivInfo.setTransients().
civInfo.setCitiesConnectedToCapitalTransients()
civInfo.initialSetCitiesConnectedToCapitalTransients()
// We need to determine the GLOBAL happiness state in order to determine the city stats
for(cityInfo in civInfo.cities) cityInfo.cityStats.updateCityHappiness()

View file

@ -64,7 +64,8 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
civInfo.containsBuildingUnique("Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)")
}
fun setCitiesConnectedToCapitalTransients(){
fun setCitiesConnectedToCapitalTransients(initialSetup:Boolean=false){
if(civInfo.cities.isEmpty()) return // eg barbarians
// We map which cities we've reached, to the mediums they've been reached by -
@ -124,6 +125,12 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
citiesToCheck = newCitiesToCheck
}
if(!initialSetup){ // In the initial setup we're loading an old game state, so it doesn't really count
for(city in citiesReachedToMediums.keys)
if(city !in civInfo.citiesConnectedToCapital)
civInfo.addNotification("[${city.name}] has been connected to your capital!",city.location, Color.GOLD)
}
civInfo.citiesConnectedToCapital = citiesReachedToMediums.keys.toList()
}

View file

@ -327,7 +327,7 @@ class CivilizationInfo {
}
// implementation in a seperate class, to not clog up CivInfo
fun setCitiesConnectedToCapitalTransients() = transients().setCitiesConnectedToCapitalTransients()
fun initialSetCitiesConnectedToCapitalTransients() = transients().setCitiesConnectedToCapitalTransients(true)
fun updateHasActiveGreatWall() = transients().updateHasActiveGreatWall()
fun updateViewableTiles() = transients().updateViewableTiles()
fun updateDetailedCivResources() = transients().updateDetailedCivResources()
@ -343,7 +343,7 @@ class CivilizationInfo {
}
updateViewableTiles() // adds explored tiles so that the units will be able to perform automated actions better
setCitiesConnectedToCapitalTransients()
transients().setCitiesConnectedToCapitalTransients()
for (city in cities) city.startTurn()
getCivUnits().toList().forEach { it.startTurn() }