mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-08 10:04:28 +07:00
When selecting a unit, show only arrows relevant to selected unit
This commit is contained in:
parent
19943baa44
commit
d8afdd0f42
@ -553,8 +553,10 @@ class WorldMapHolder(
|
||||
* @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>>) {
|
||||
val selectedUnit = worldScreen.bottomUnitTable.selectedUnit
|
||||
for (unit in pastVisibleUnits) {
|
||||
if (unit.movementMemories.isEmpty()) continue
|
||||
if (selectedUnit != null && selectedUnit != unit) continue // When selecting a unit, show only arrows of that unit
|
||||
val stepIter = unit.movementMemories.iterator()
|
||||
var previous = stepIter.next()
|
||||
while (stepIter.hasNext()) {
|
||||
@ -571,6 +573,9 @@ class WorldMapHolder(
|
||||
addArrow(unit.getTile(), toTile, MiscArrowTypes.UnitMoving)
|
||||
}
|
||||
for ((from, to) in visibleAttacks) {
|
||||
if (selectedUnit != null
|
||||
&& selectedUnit.currentTile.position != from
|
||||
&& selectedUnit.currentTile.position != to) continue
|
||||
addArrow(tileMap[from], tileMap[to], MiscArrowTypes.UnitHasAttacked)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user