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)
val viewedCivs = HashSet<CivilizationInfo>()
val viewedCivs = HashMap<CivilizationInfo,TileInfo>()
for (tile in civInfo.viewableTiles) {
val tileOwner = tile.getOwner()
if (tileOwner != null) viewedCivs += tileOwner
for (unit in tile.getUnits()) viewedCivs += unit.civInfo
if (tileOwner != null) viewedCivs[civInfo] = tile
for (unit in tile.getUnits()) viewedCivs[unit.civInfo] = tile
}
if (!civInfo.isBarbarian()) {
for (otherCiv in viewedCivs.filterNot { it == civInfo || it.isBarbarian() }) {
if (!civInfo.diplomacy.containsKey(otherCiv.civName)) {
civInfo.meetCivilization(otherCiv)
civInfo.addNotification("We have encountered [" + otherCiv.civName + "]!", null, Color.GOLD)
}
for (entry in viewedCivs) {
val metCiv = entry.key
if (metCiv == civInfo || metCiv.isBarbarian() || civInfo.diplomacy.containsKey(metCiv.civName)) continue
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()

View File

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