mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 03:18:18 +07:00
Quick win for #7491 - only update resources after trade/unit if resources are relevant
This commit is contained in:
parent
ae187f4f85
commit
858c7bc256
@ -483,7 +483,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
// exception will happen), also rearrange existing units so that
|
||||
// 'nextPotentiallyDueAt' becomes 0. This way new units are always last to be due
|
||||
// (can be changed as wanted, just have a predictable place).
|
||||
var newList = getCivUnitsStartingAtNextDue().toMutableList()
|
||||
val newList = getCivUnitsStartingAtNextDue().toMutableList()
|
||||
newList.add(mapUnit)
|
||||
units = newList
|
||||
nextPotentiallyDueAt = 0
|
||||
@ -492,19 +492,21 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
// Not relevant when updating TileInfo transients, since some info of the civ itself isn't yet available,
|
||||
// and in any case it'll be updated once civ info transients are
|
||||
updateStatsForNextTurn() // unit upkeep
|
||||
updateDetailedCivResources()
|
||||
if (mapUnit.baseUnit.getResourceRequirements().isNotEmpty())
|
||||
updateDetailedCivResources()
|
||||
}
|
||||
}
|
||||
|
||||
fun removeUnit(mapUnit: MapUnit) {
|
||||
// See comment in addUnit().
|
||||
var newList = getCivUnitsStartingAtNextDue().toMutableList()
|
||||
val newList = getCivUnitsStartingAtNextDue().toMutableList()
|
||||
newList.remove(mapUnit)
|
||||
units = newList
|
||||
nextPotentiallyDueAt = 0
|
||||
|
||||
updateStatsForNextTurn() // unit upkeep
|
||||
updateDetailedCivResources()
|
||||
if (mapUnit.baseUnit.getResourceRequirements().isNotEmpty())
|
||||
updateDetailedCivResources()
|
||||
}
|
||||
|
||||
fun getIdleUnits() = getCivUnits().filter { it.isIdle() }
|
||||
|
@ -580,7 +580,9 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
else civInfo.addNotification("[${offer.name}] to [$otherCivName] has ended", otherCivName, NotificationIcon.Trade)
|
||||
|
||||
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
|
||||
civInfo.updateDetailedCivResources() // if they were giving us resources
|
||||
if (trade.theirOffers.union(trade.ourOffers) // if resources were involved
|
||||
.any { it.type == TradeType.Luxury_Resource || it.type == TradeType.Strategic_Resource })
|
||||
civInfo.updateDetailedCivResources()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user