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