1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Full exchange when holding alt while pressing exchange screen creature arrow button

This commit is contained in:
Dydzio 2024-12-03 20:40:06 +01:00
parent 150f4904ab
commit ceac0bc203
2 changed files with 11 additions and 2 deletions

View File

@ -248,7 +248,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
Point(484 + 35 * i, 154),
AnimationPath::builtin("quick-exchange/unitLeft.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
std::bind(&CExchangeController::moveStack, &controller, false, SlotID(i))));
[this, i]() { creatureArrowButtonCallback(false, SlotID(i)); }));
moveUnitFromRightToLeftButtons.back()->block(leftHeroBlock);
moveUnitFromLeftToRightButtons.push_back(
@ -256,7 +256,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
Point(66 + 35 * i, 154),
AnimationPath::builtin("quick-exchange/unitRight.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
std::bind(&CExchangeController::moveStack, &controller, true, SlotID(i))));
[this, i]() { creatureArrowButtonCallback(true, SlotID(i)); }));
moveUnitFromLeftToRightButtons.back()->block(rightHeroBlock);
}
}
@ -264,6 +264,14 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
CExchangeWindow::update();
}
void CExchangeWindow::creatureArrowButtonCallback(bool leftToRight, SlotID slotId)
{
if (GH.isKeyboardAltDown())
controller.moveArmy(leftToRight, slotId);
else
controller.moveStack(leftToRight, slotId);
}
void CExchangeWindow::moveArtifactsCallback(bool leftToRight)
{
bool moveEquipped = !GH.isKeyboardShiftDown();

View File

@ -54,6 +54,7 @@ class CExchangeWindow : public CStatusbarWindow, public IGarrisonHolder, public
std::shared_ptr<CButton> backpackButtonRight;
CExchangeController controller;
void creatureArrowButtonCallback(bool leftToRight, SlotID slotID);
void moveArtifactsCallback(bool leftToRight);
void swapArtifactsCallback();
void moveUnitsShortcut(bool leftToRight);