fheroes2
fheroes2 copied to clipboard
Add swap army and improve move army
Close #4084
This is not yet implemented/done:
- [ ] Tidying/better structuring of the code.
This is currently implemented:
- [x] Swap armies with "heroes as guardians" option enabled.
- [x] Move armies with "heroes as guardians" option enabled.
- [x] Move the troop that was selected/highlighted last.
- [x] Fix move logic so that moved troops keep their positions in the army and so that similar troops are not unnecessarily merged if there are free slots.
- [x] Swap armies in heroes meeting screen. Hotkey SPACE and right mouse click within both arrow button areas.
- [x] Move hotkeys in heroes meeting screen. Hotkeys Left and Right arrow.
- [x] Mouse drag and drop input for moving armies in castle. This is done by dragging from the armybar you want to move from to the hero portrait or the crest symbol. See referenced issue for more info.
- [x] Swap armies in the castle by pressing SPACE or by left-clicking the Crest icon.
- [x] Move all troops by pressing up or down arrow keys in the castle.
Dropped:
- Move troops according to tier/dwelling level/any other attribute starting from the troop with the highest of it.
Hi, @ihhub!
This PR is ready for your review when you have the time and feel like it. The only part I wasn't able to do was replace use of ArmyBar::SetArmy() with swapArmies() and MoveTroops() in Castle_Dialog.cpp. I've tried to replace this old method but no matter what I try, the troops will end up in the original placement of either top armybar or bottom armybar when swapping between the guest and guard hero, even if it seemingly works but as you leave the castle you'll realize the troops did not more.
Aside from this the missing part now is the graphical side of it so you don't just move the cursor in the air with no real feedback. Unless this can be easily implemented, I think it might be more fit for another PR? For me either way is fine. It is a valid point that implementing this current PR should wait until a proper GUI way of showing the move and hero portrait swap is implemented so as not to confuse users and to facilitate things for testers.
Oh, and I need to figure out how to make the new hotkey for swapping armies show up in the in-game hotkey dialog.