mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 05:51:12 +07:00
Resolve #11795 - fix performance problem for displaying air units in cities
This commit is contained in:
parent
0678957c8e
commit
39de50829a
@ -75,7 +75,7 @@ class RoadBetweenCitiesAutomation(val civInfo: Civilization, cachedForTurn: Int,
|
||||
/**
|
||||
* Tries to return a list of road plans to connect this city to the surrounding cities.
|
||||
* If there are no surrounding cities to connect to and this city is still unconnected to the capital it will try and build a special road to the capital.
|
||||
*
|
||||
*
|
||||
* @return every road that we want to try and connect assosiated with this city.
|
||||
*/
|
||||
fun getRoadsToBuildFromCity(city: City): List<RoadPlan> {
|
||||
@ -144,7 +144,7 @@ class RoadBetweenCitiesAutomation(val civInfo: Civilization, cachedForTurn: Int,
|
||||
if (roadToCapital != null) {
|
||||
val worstRoadStatus = getWorstRoadTypeInPath(roadToCapital.second)
|
||||
var roadPriority = basePriority
|
||||
roadPriority += if (worstRoadStatus == RoadStatus.None) 2f else 1f
|
||||
roadPriority += if (worstRoadStatus == RoadStatus.None) 2f else 1f
|
||||
|
||||
val newRoadPlan = RoadPlan(roadToCapital.second, roadPriority + (city.population.population) / 2f, city, roadToCapital.first)
|
||||
roadsToBuild.add(newRoadPlan)
|
||||
@ -155,7 +155,6 @@ class RoadBetweenCitiesAutomation(val civInfo: Civilization, cachedForTurn: Int,
|
||||
}
|
||||
}
|
||||
|
||||
workerUnit.destroy()
|
||||
roadsToBuildByCitiesCache[city] = roadsToBuild
|
||||
return roadsToBuild
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ import com.unciv.models.ruleset.RejectionReason
|
||||
import com.unciv.models.ruleset.RejectionReasonType
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.RulesetObject
|
||||
import com.unciv.models.ruleset.unique.Conditionals
|
||||
import com.unciv.models.ruleset.unique.StateForConditionals
|
||||
import com.unciv.models.ruleset.unique.Unique
|
||||
import com.unciv.models.ruleset.unique.UniqueTarget
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.ruleset.unique.Conditionals
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.ui.components.extensions.getNeedMoreAmountString
|
||||
import com.unciv.ui.components.extensions.toPercent
|
||||
@ -194,11 +194,11 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
|
||||
// Expensive, since adding and removing the fake unit causes side-effects
|
||||
if (isAirUnit()) {
|
||||
// Not actually added to civ so doesn't require destroy
|
||||
val fakeUnit = getMapUnit(cityConstructions.city.civ, Constants.NO_ID)
|
||||
val canUnitEnterTile = fakeUnit.movement.canMoveTo(cityConstructions.city.getCenterTile())
|
||||
if (!canUnitEnterTile)
|
||||
yield(RejectionReasonType.NoPlaceToPutUnit.toInstance())
|
||||
fakeUnit.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1927,6 +1927,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Modifiers that can be added to other uniques to limit when they will be active
|
||||
|
||||
??? example "<for [amount] turns>"
|
||||
Turns this unique into a trigger, activating this unique as a *global* unique for a number of turns
|
||||
Example: "<for [3] turns>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -2113,18 +2114,21 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when above [amount] [stat/resource]>"
|
||||
Stats refers to the accumulated stat, not stat-per-turn
|
||||
Example: "<when above [3] [Culture]>"
|
||||
|
||||
This unique's effect can be modified with <(modified by game speed)>
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when below [amount] [stat/resource]>"
|
||||
Stats refers to the accumulated stat, not stat-per-turn
|
||||
Example: "<when below [3] [Culture]>"
|
||||
|
||||
This unique's effect can be modified with <(modified by game speed)>
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when between [amount] and [amount] [stat/resource]>"
|
||||
Stats refers to the accumulated stat, not stat-per-turn
|
||||
Example: "<when between [3] and [3] [Culture]>"
|
||||
|
||||
This unique's effect can be modified with <(modified by game speed)>
|
||||
|
Loading…
Reference in New Issue
Block a user