mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Performance boost for GameInfo.setTransients - speeds up loadGame and nextTurn
This commit is contained in:
parent
6a969b98f5
commit
fbec7c836e
@ -417,7 +417,8 @@ class GameInfo {
|
|||||||
|
|
||||||
for (civInfo in civilizations) {
|
for (civInfo in civilizations) {
|
||||||
for (unit in civInfo.getCivUnits())
|
for (unit in civInfo.getCivUnits())
|
||||||
unit.updateVisibleTiles() // this needs to be done after all the units are assigned to their civs and all other transients are set
|
unit.updateVisibleTiles(false) // this needs to be done after all the units are assigned to their civs and all other transients are set
|
||||||
|
civInfo.updateViewableTiles() // only run ONCE and not for each unit - this is a huge performance saver!
|
||||||
|
|
||||||
// Since this depends on the cities of ALL civilizations,
|
// 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.
|
// we need to wait until we've set the transients of all the cities before we can run this.
|
||||||
|
@ -500,7 +500,6 @@ class CityStats(val cityInfo: CityInfo) {
|
|||||||
statPercentBonusTree = newStatsBonusTree
|
statPercentBonusTree = newStatsBonusTree
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Does not update tile stats - instead, updating tile stats updates this */
|
|
||||||
fun update(currentConstruction: IConstruction = cityInfo.cityConstructions.getCurrentConstruction(),
|
fun update(currentConstruction: IConstruction = cityInfo.cityConstructions.getCurrentConstruction(),
|
||||||
updateTileStats:Boolean = true) {
|
updateTileStats:Boolean = true) {
|
||||||
if (updateTileStats) updateTileStats()
|
if (updateTileStats) updateTileStats()
|
||||||
|
@ -402,7 +402,7 @@ class MapUnit {
|
|||||||
/**
|
/**
|
||||||
* Update this unit's cache of viewable tiles and its civ's as well.
|
* Update this unit's cache of viewable tiles and its civ's as well.
|
||||||
*/
|
*/
|
||||||
fun updateVisibleTiles() {
|
fun updateVisibleTiles(updateCivViewableTiles:Boolean = true) {
|
||||||
if (baseUnit.isAirUnit()) {
|
if (baseUnit.isAirUnit()) {
|
||||||
viewableTiles = if (hasUnique(UniqueType.SixTilesAlwaysVisible))
|
viewableTiles = if (hasUnique(UniqueType.SixTilesAlwaysVisible))
|
||||||
getTile().getTilesInDistance(6).toList() // it's that simple
|
getTile().getTilesInDistance(6).toList() // it's that simple
|
||||||
@ -411,7 +411,7 @@ class MapUnit {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
viewableTiles = getTile().getViewableTilesList(getVisibilityRange())
|
viewableTiles = getTile().getViewableTilesList(getVisibilityRange())
|
||||||
civInfo.updateViewableTiles() // for the civ
|
if (updateCivViewableTiles) civInfo.updateViewableTiles() // for the civ
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isActionUntilHealed() = action?.endsWith("until healed") == true
|
fun isActionUntilHealed() = action?.endsWith("until healed") == true
|
||||||
|
@ -1377,7 +1377,6 @@ Applicable to: Conditional
|
|||||||
- "-[amount]% Culture cost of acquiring tiles [cityFilter]" - Deprecated As of 3.19.1, replace with "[-amount]% Culture cost of natural border growth [cityFilter]"
|
- "-[amount]% Culture cost of acquiring tiles [cityFilter]" - Deprecated As of 3.19.1, replace with "[-amount]% Culture cost of natural border growth [cityFilter]"
|
||||||
- "[amount]% cost of natural border growth" - Deprecated As of 3.19.1, replace with "[amount]% Culture cost of natural border growth [cityFilter]"
|
- "[amount]% cost of natural border growth" - Deprecated As of 3.19.1, replace with "[amount]% Culture cost of natural border growth [cityFilter]"
|
||||||
- "-[amount]% Gold cost of acquiring tiles [cityFilter]" - Deprecated As of 3.19.1, replace with "[-amount]% Gold cost of acquiring tiles [cityFilter]"
|
- "-[amount]% Gold cost of acquiring tiles [cityFilter]" - Deprecated As of 3.19.1, replace with "[-amount]% Gold cost of acquiring tiles [cityFilter]"
|
||||||
- "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] starting from the [era] at an increasing price ([amount])" - Deprecated As of 3.17.9, replace with "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount]) <starting from the [era]>"
|
|
||||||
- "Maintenance on roads & railroads reduced by [amount]%" - Deprecated As of 3.18.17, replace with "[-amount]% maintenance on road & railroads"
|
- "Maintenance on roads & railroads reduced by [amount]%" - Deprecated As of 3.18.17, replace with "[-amount]% maintenance on road & railroads"
|
||||||
- "-[amount]% maintenance cost for buildings [cityFilter]" - Deprecated As of 3.18.17, replace with "[-amount]% maintenace cost for buildings [cityFilter]"
|
- "-[amount]% maintenance cost for buildings [cityFilter]" - Deprecated As of 3.18.17, replace with "[-amount]% maintenace cost for buildings [cityFilter]"
|
||||||
- "+[amount] happiness from each type of luxury resource" - Deprecated As of 3.18.17, replace with "[+amount] Happiness from each type of luxury resource"
|
- "+[amount] happiness from each type of luxury resource" - Deprecated As of 3.18.17, replace with "[+amount] Happiness from each type of luxury resource"
|
||||||
@ -1394,6 +1393,7 @@ Applicable to: Conditional
|
|||||||
- "Melee units pay no movement cost to pillage" - Deprecated As of 3.18.17, replace with "No movement cost to pillage <for [Melee] units>"
|
- "Melee units pay no movement cost to pillage" - Deprecated As of 3.18.17, replace with "No movement cost to pillage <for [Melee] units>"
|
||||||
- "[mapUnitFilter] units gain [amount]% more Experience from combat" - Deprecated As of 3.18.12, replace with "[amount]% XP gained from combat <for [mapUnitFilter] units>"
|
- "[mapUnitFilter] units gain [amount]% more Experience from combat" - Deprecated As of 3.18.12, replace with "[amount]% XP gained from combat <for [mapUnitFilter] units>"
|
||||||
- "[amount]% maintenance costs for [mapUnitFilter] units" - Deprecated As of 3.18.14, replace with "[amount]% maintenance costs <for [mapUnitFilter] units>"
|
- "[amount]% maintenance costs for [mapUnitFilter] units" - Deprecated As of 3.18.14, replace with "[amount]% maintenance costs <for [mapUnitFilter] units>"
|
||||||
|
- "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] starting from the [era] at an increasing price ([amount])" - Deprecated As of 3.17.9, removed as of 3.19.3, replace with "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount]) <starting from the [era]>"
|
||||||
- "Provides a free [buildingName] [cityFilter]" - Deprecated As of 3.17.7 - removed 3.18.19, replace with "Gain a free [buildingName] [cityFilter]"
|
- "Provides a free [buildingName] [cityFilter]" - Deprecated As of 3.17.7 - removed 3.18.19, replace with "Gain a free [buildingName] [cityFilter]"
|
||||||
- "+[amount]% [stat] [cityFilter]" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [cityFilter]"
|
- "+[amount]% [stat] [cityFilter]" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [cityFilter]"
|
||||||
- "+[amount]% [stat] in all cities" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [in all cities]"
|
- "+[amount]% [stat] in all cities" - Deprecated As of 3.17.10 - removed 3.18.18, replace with "[+amount]% [stat] [in all cities]"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user