Resolved #2576 - Clicking on "Encountering" notifications now move the map to the encounter location

This commit is contained in:
Yair Morgenstern 2020-05-04 20:22:23 +03:00
parent 7484d2c2cf
commit 2b3a9c14bf
2 changed files with 10 additions and 9 deletions

View File

@ -29,19 +29,20 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
civInfo.exploredTiles.addAll(newlyExploredTiles) civInfo.exploredTiles.addAll(newlyExploredTiles)
val viewedCivs = HashSet<CivilizationInfo>() val viewedCivs = HashMap<CivilizationInfo,TileInfo>()
for (tile in civInfo.viewableTiles) { for (tile in civInfo.viewableTiles) {
val tileOwner = tile.getOwner() val tileOwner = tile.getOwner()
if (tileOwner != null) viewedCivs += tileOwner if (tileOwner != null) viewedCivs[civInfo] = tile
for (unit in tile.getUnits()) viewedCivs += unit.civInfo for (unit in tile.getUnits()) viewedCivs[unit.civInfo] = tile
} }
if (!civInfo.isBarbarian()) { if (!civInfo.isBarbarian()) {
for (otherCiv in viewedCivs.filterNot { it == civInfo || it.isBarbarian() }) { for (entry in viewedCivs) {
if (!civInfo.diplomacy.containsKey(otherCiv.civName)) { val metCiv = entry.key
civInfo.meetCivilization(otherCiv) if (metCiv == civInfo || metCiv.isBarbarian() || civInfo.diplomacy.containsKey(metCiv.civName)) continue
civInfo.addNotification("We have encountered [" + otherCiv.civName + "]!", null, Color.GOLD) civInfo.meetCivilization(metCiv)
} civInfo.addNotification("We have encountered [" + metCiv.civName + "]!", entry.value.position, Color.GOLD)
metCiv.addNotification("We have encountered [" + civInfo.civName + "]!", entry.value.position, Color.GOLD)
} }
discoverNaturalWonders() discoverNaturalWonders()

View File

@ -252,8 +252,8 @@ class CivilizationInfo {
otherCiv.diplomacy[civName] = DiplomacyManager(otherCiv, civName) otherCiv.diplomacy[civName] = DiplomacyManager(otherCiv, civName)
.apply { diplomaticStatus = DiplomaticStatus.Peace } .apply { diplomaticStatus = DiplomaticStatus.Peace }
popupAlerts.add(PopupAlert(AlertType.FirstContact,otherCiv.civName)) popupAlerts.add(PopupAlert(AlertType.FirstContact,otherCiv.civName))
if(isCurrentPlayer() || otherCiv.isCurrentPlayer()) if(isCurrentPlayer() || otherCiv.isCurrentPlayer())
UncivGame.Current.settings.addCompletedTutorialTask("Meet another civilization") UncivGame.Current.settings.addCompletedTutorialTask("Meet another civilization")
} }