Unciv/android/Images/OtherIcons
Arthur van der Staaij a7afc0718c
Unit swapping (#4049)
* Added an icon for unit swapping

* Implemented unit swapping

In the original Civ V, unit swapping is a supported mechanic.
If you try to move a unit to a tile with another of your units, and both
units have enough movement points left to reach the other's tile, they
will swap places. They will consume only the movement points needed to
reach the other's tile in this way.

This change implements unit swapping for Unciv.

To prevent all kinds of problems from arising with automatic unit
movement, unit swapping can only be done explicitly. This also means
that it can only be done if the unit-swap movement is possible in a
single turn. It is however not limited to adjacent units.

Because Unciv supports mobile devices, there is in general no separation
between a unit-selection click and a movement click. Clicking on another
unit while a unit is selected simply selects that other unit. Because we
do not want to make it more difficult to select other units in this way,
unit swapping is implemented as a separate "movement mode": to toggle
this mode on or off, the new unit action "Swap units" must be used.
Newly selected units still always start in the normal movement mode.

In the unit-swap movement mode, the possible swap tiles are highlighted
instead of the possible movement and attack tiles. Clicking on a
highlighted tile will display a swap button, similar to the movement
button, or instantly perform the swap if single-click-movement is
enabled. This new behavior overrides the selection of the unit on the
target tile: if the user wants to select the unit instead, they have to
exit the unit-swapping mode first.

The swapping code is robust, it can even handle swaps that involve a
paradrop!

An option to always swap-move when an eligible tile is clicked instead
of requiring the unit-swapping mode, similar to the existing
single-click-movement option, could perhaps be added in later.

* Added some comments to existing movement functions

* Fixed a silly mistake

Fixed a silly mistake which caused the unit-swapping eligibility
detection to sometimes remove units from the world.

* Removed some unneeded code

* Fixed movement buttons not showing with world wrap

Fixed a bug where the "move here" and "swap with" buttons would only
show on the leftmost copy of the world when world wrap was enabled.

* Made the swap action only display if usable

Made the unit swapping button only display if there is at least one
possible swap movement.
2021-06-06 22:56:25 +03:00
..
Aircraft.png Can now see when city contains air units 2019-07-03 23:32:17 +03:00
BackArrow.png Organized Unit Table UI 2018-11-23 14:36:22 +02:00
Banner.png Steam Power and Astronomy now increase embarked units' movement 2018-11-04 13:07:03 +02:00
buttonBackground.png UI Update (#3102) 2020-09-10 19:25:56 +03:00
Camera.png Better camera square 2021-05-28 14:53:21 +03:00
Circle.png Finished off promotions, adding Formation I, Formation II, Blitz, Logistics, Mobility, and Volley promotions 2018-08-28 12:12:14 +03:00
Cities.png Overview screen category decoration + key hint (#3872) 2021-05-04 12:10:34 +03:00
Close.png Add close icon for the UnitTable (#1472) 2019-12-17 21:44:20 +02:00
Crosshair.png Display the crosshair in alternate color for distant targets (#2347) 2020-04-07 11:37:14 +03:00
Diplomacy.png Removed ALL color-based notifications! 2021-03-21 00:28:58 +02:00
DiplomacyW.png Overview screen category decoration + key hint (#3872) 2021-05-04 12:10:34 +03:00
DisbandUnit.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Down.png City construction queue (#1479) 2020-01-09 20:58:15 +02:00
Fire.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Hexagon.png Fantasy hex tileset is go! 2019-03-19 18:35:58 +02:00
Load.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
Lock.png Resolved #1779 - Can now lock worked tiles to prevent them from being unassigned 2020-03-29 12:42:58 +03:00
MapEditor.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
MenuIcon.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Mods.png Added Unzip functionality - we should soon be ready for mod management from within the game! 2020-08-25 16:38:55 +03:00
Multiplayer.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
New.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
Options.png OptionsPopup with two experimental switches: Spectator mode, Extended Map editor. (#2834) 2020-07-12 12:59:32 +03:00
Pentagon.png Added Optics and Lighthouse 2018-10-16 21:13:29 +03:00
Pillage.png Resolved #410 - land units on lake aren't shown as embarked 2019-01-08 15:43:54 +02:00
Puppet.png Added Puppet icon - some reorgnizing still needs to be done in regards to puppet vs annex 2019-09-23 10:46:51 +03:00
Quest.png City State quests (#3183) 2020-09-29 23:26:50 +03:00
Quickstart.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
Resume.png Added icons to the main menu, looks much better! 2020-04-21 14:18:38 +03:00
Shield.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Sleep.png Added "Sleep" action for units that can't fortify 2018-09-16 13:58:35 +03:00
Star.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Stop.png Replaced all resource and improvement icons! 2018-08-28 10:35:56 +03:00
Swap.png Unit swapping (#4049) 2021-06-06 22:56:25 +03:00
Triangle.png Borders made of oriented triangles rather than circles (#2104) 2020-03-08 20:36:50 +02:00
Up.png City construction queue (#1479) 2020-01-09 20:58:15 +02:00
whiteDot.png separated whiteDot for images from TableBackground for backgrounds 2019-11-08 15:42:19 +02:00