mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
4.0.6-patch1
Better timesaving for arrows that doesn't keep arrows when we disable view
This commit is contained in:
parent
8a32be0ca2
commit
94e8264d36
@ -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. */
|
/** Create and setup Actors for all arrows to be drawn from this tile. */
|
||||||
private fun updateArrows() {
|
private fun updateArrows() {
|
||||||
if (!UncivGame.Current.settings.showUnitMovements) return // don't waste time if this isn't important
|
for (actorList in arrows.values)
|
||||||
for (actorList in arrows.values) {
|
for (actor in actorList)
|
||||||
for (actor in actorList) {
|
|
||||||
actor.remove()
|
actor.remove()
|
||||||
}
|
|
||||||
}
|
|
||||||
arrows.clear()
|
arrows.clear()
|
||||||
|
|
||||||
val tileScale = 50f * 0.8f // See notes in updateRoadImages.
|
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.
|
* @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>>) {
|
internal fun updateMovementOverlay(pastVisibleUnits: Sequence<MapUnit>, targetVisibleUnits: Sequence<MapUnit>, visibleAttacks: Sequence<Pair<Vector2, Vector2>>) {
|
||||||
if (!UncivGame.Current.settings.showUnitMovements) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for (unit in pastVisibleUnits) {
|
for (unit in pastVisibleUnits) {
|
||||||
if (unit.movementMemories.isEmpty()) {
|
if (unit.movementMemories.isEmpty()) continue
|
||||||
continue
|
|
||||||
}
|
|
||||||
val stepIter = unit.movementMemories.iterator()
|
val stepIter = unit.movementMemories.iterator()
|
||||||
var previous = stepIter.next()
|
var previous = stepIter.next()
|
||||||
while (stepIter.hasNext()) {
|
while (stepIter.hasNext()) {
|
||||||
|
@ -415,15 +415,17 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Bas
|
|||||||
unitActionsTable.y = bottomUnitTable.height
|
unitActionsTable.y = bottomUnitTable.height
|
||||||
|
|
||||||
mapHolder.resetArrows()
|
mapHolder.resetArrows()
|
||||||
val allUnits = gameInfo.civilizations.asSequence().flatMap { it.getCivUnits() }
|
if (UncivGame.Current.settings.showUnitMovements) {
|
||||||
val allAttacks = allUnits.map { unit -> unit.attacksSinceTurnStart.asSequence().map { attacked -> Triple(unit.civInfo, unit.getTile().position, attacked) } }.flatten() +
|
val allUnits = gameInfo.civilizations.asSequence().flatMap { it.getCivUnits() }
|
||||||
gameInfo.civilizations.asSequence().flatMap { civInfo -> civInfo.attacksSinceTurnStart.asSequence().map { Triple(civInfo, it.source, it.target) } }
|
val allAttacks = allUnits.map { unit -> unit.attacksSinceTurnStart.asSequence().map { attacked -> Triple(unit.civInfo, unit.getTile().position, attacked) } }.flatten() +
|
||||||
mapHolder.updateMovementOverlay(
|
gameInfo.civilizations.asSequence().flatMap { civInfo -> civInfo.attacksSinceTurnStart.asSequence().map { Triple(civInfo, it.source, it.target) } }
|
||||||
allUnits.filter(mapVisualization::isUnitPastVisible),
|
mapHolder.updateMovementOverlay(
|
||||||
allUnits.filter(mapVisualization::isUnitFutureVisible),
|
allUnits.filter(mapVisualization::isUnitPastVisible),
|
||||||
allAttacks.filter { (attacker, source, target) -> mapVisualization.isAttackVisible(attacker, source, target) }
|
allUnits.filter(mapVisualization::isUnitFutureVisible),
|
||||||
.map { (_, source, target) -> source to target }
|
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
|
// 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
|
// it doesn't update the explored tiles of the civ... need to think about that harder
|
||||||
|
Loading…
x
Reference in New Issue
Block a user