mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-10 00:43:59 +02:00
Merge pull request #5032 from dydzio0614/alt-creature-buttons
Exchange full army by holding alt while pressing VCMI extras creature arrow button
This commit is contained in:
commit
7543635847
@ -79,6 +79,10 @@ void CExchangeController::moveArmy(bool leftToRight, std::optional<SlotID> heldS
|
|||||||
});
|
});
|
||||||
heldSlot = weakestSlot->first;
|
heldSlot = weakestSlot->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source->getCreature(heldSlot.value()) == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
LOCPLINT->cb->bulkMoveArmy(source->id, target->id, heldSlot.value());
|
LOCPLINT->cb->bulkMoveArmy(source->id, target->id, heldSlot.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
|||||||
Point(484 + 35 * i, 154),
|
Point(484 + 35 * i, 154),
|
||||||
AnimationPath::builtin("quick-exchange/unitLeft.DEF"),
|
AnimationPath::builtin("quick-exchange/unitLeft.DEF"),
|
||||||
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
|
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);
|
moveUnitFromRightToLeftButtons.back()->block(leftHeroBlock);
|
||||||
|
|
||||||
moveUnitFromLeftToRightButtons.push_back(
|
moveUnitFromLeftToRightButtons.push_back(
|
||||||
@ -256,7 +256,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
|||||||
Point(66 + 35 * i, 154),
|
Point(66 + 35 * i, 154),
|
||||||
AnimationPath::builtin("quick-exchange/unitRight.DEF"),
|
AnimationPath::builtin("quick-exchange/unitRight.DEF"),
|
||||||
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
|
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);
|
moveUnitFromLeftToRightButtons.back()->block(rightHeroBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,6 +264,14 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
|||||||
CExchangeWindow::update();
|
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)
|
void CExchangeWindow::moveArtifactsCallback(bool leftToRight)
|
||||||
{
|
{
|
||||||
bool moveEquipped = !GH.isKeyboardShiftDown();
|
bool moveEquipped = !GH.isKeyboardShiftDown();
|
||||||
|
@ -54,6 +54,7 @@ class CExchangeWindow : public CStatusbarWindow, public IGarrisonHolder, public
|
|||||||
std::shared_ptr<CButton> backpackButtonRight;
|
std::shared_ptr<CButton> backpackButtonRight;
|
||||||
CExchangeController controller;
|
CExchangeController controller;
|
||||||
|
|
||||||
|
void creatureArrowButtonCallback(bool leftToRight, SlotID slotID);
|
||||||
void moveArtifactsCallback(bool leftToRight);
|
void moveArtifactsCallback(bool leftToRight);
|
||||||
void swapArtifactsCallback();
|
void swapArtifactsCallback();
|
||||||
void moveUnitsShortcut(bool leftToRight);
|
void moveUnitsShortcut(bool leftToRight);
|
||||||
|
Loading…
Reference in New Issue
Block a user