mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 16:49:15 +07:00
4.0.6-patch1
Better timesaving for arrows that doesn't keep arrows when we disable view
This commit is contained in:
@ -558,12 +558,9 @@ open class TileGroup(var tileInfo: TileInfo, val tileSetStrings:TileSetStrings,
|
||||
|
||||
/** Create and setup Actors for all arrows to be drawn from this tile. */
|
||||
private fun updateArrows() {
|
||||
if (!UncivGame.Current.settings.showUnitMovements) return // don't waste time if this isn't important
|
||||
for (actorList in arrows.values) {
|
||||
for (actor in actorList) {
|
||||
for (actorList in arrows.values)
|
||||
for (actor in actorList)
|
||||
actor.remove()
|
||||
}
|
||||
}
|
||||
arrows.clear()
|
||||
|
||||
val tileScale = 50f * 0.8f // See notes in updateRoadImages.
|
||||
|
@ -486,13 +486,8 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
* @param visibleAttacks Sequence of pairs of [Vector2] positions of the sources and the targets of all attacks that can be displayed.
|
||||
* */
|
||||
internal fun updateMovementOverlay(pastVisibleUnits: Sequence<MapUnit>, targetVisibleUnits: Sequence<MapUnit>, visibleAttacks: Sequence<Pair<Vector2, Vector2>>) {
|
||||
if (!UncivGame.Current.settings.showUnitMovements) {
|
||||
return
|
||||
}
|
||||
for (unit in pastVisibleUnits) {
|
||||
if (unit.movementMemories.isEmpty()) {
|
||||
continue
|
||||
}
|
||||
if (unit.movementMemories.isEmpty()) continue
|
||||
val stepIter = unit.movementMemories.iterator()
|
||||
var previous = stepIter.next()
|
||||
while (stepIter.hasNext()) {
|
||||
|
@ -415,15 +415,17 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Bas
|
||||
unitActionsTable.y = bottomUnitTable.height
|
||||
|
||||
mapHolder.resetArrows()
|
||||
val allUnits = gameInfo.civilizations.asSequence().flatMap { it.getCivUnits() }
|
||||
val allAttacks = allUnits.map { unit -> unit.attacksSinceTurnStart.asSequence().map { attacked -> Triple(unit.civInfo, unit.getTile().position, attacked) } }.flatten() +
|
||||
gameInfo.civilizations.asSequence().flatMap { civInfo -> civInfo.attacksSinceTurnStart.asSequence().map { Triple(civInfo, it.source, it.target) } }
|
||||
mapHolder.updateMovementOverlay(
|
||||
allUnits.filter(mapVisualization::isUnitPastVisible),
|
||||
allUnits.filter(mapVisualization::isUnitFutureVisible),
|
||||
allAttacks.filter { (attacker, source, target) -> mapVisualization.isAttackVisible(attacker, source, target) }
|
||||
.map { (_, source, target) -> source to target }
|
||||
)
|
||||
if (UncivGame.Current.settings.showUnitMovements) {
|
||||
val allUnits = gameInfo.civilizations.asSequence().flatMap { it.getCivUnits() }
|
||||
val allAttacks = allUnits.map { unit -> unit.attacksSinceTurnStart.asSequence().map { attacked -> Triple(unit.civInfo, unit.getTile().position, attacked) } }.flatten() +
|
||||
gameInfo.civilizations.asSequence().flatMap { civInfo -> civInfo.attacksSinceTurnStart.asSequence().map { Triple(civInfo, it.source, it.target) } }
|
||||
mapHolder.updateMovementOverlay(
|
||||
allUnits.filter(mapVisualization::isUnitPastVisible),
|
||||
allUnits.filter(mapVisualization::isUnitFutureVisible),
|
||||
allAttacks.filter { (attacker, source, target) -> mapVisualization.isAttackVisible(attacker, source, target) }
|
||||
.map { (_, source, target) -> source to target }
|
||||
)
|
||||
}
|
||||
|
||||
// if we use the clone, then when we update viewable tiles
|
||||
// it doesn't update the explored tiles of the civ... need to think about that harder
|
||||
|
Reference in New Issue
Block a user