mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Merge pull request #5433 from dydzio0614/qol-shortcuts-fixes
[1.6.6] Quality of life shortcuts fixes
This commit is contained in:
@@ -295,6 +295,7 @@ enum class EShortcut
|
||||
// Spellbook screen
|
||||
SPELLBOOK_TAB_ADVENTURE,
|
||||
SPELLBOOK_TAB_COMBAT,
|
||||
SPELLBOOK_SEARCH_FOCUS,
|
||||
|
||||
LIST_HERO_UP,
|
||||
LIST_HERO_DOWN,
|
||||
|
@@ -277,6 +277,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
|
||||
{"heroCostumeLoad9", EShortcut::HERO_COSTUME_LOAD_9 },
|
||||
{"spellbookTabAdventure", EShortcut::SPELLBOOK_TAB_ADVENTURE },
|
||||
{"spellbookTabCombat", EShortcut::SPELLBOOK_TAB_COMBAT },
|
||||
{"spellbookSearchFocus", EShortcut::SPELLBOOK_SEARCH_FOCUS },
|
||||
{"listHeroUp", EShortcut::LIST_HERO_UP },
|
||||
{"listHeroDown", EShortcut::LIST_HERO_DOWN },
|
||||
{"listHeroTop", EShortcut::LIST_HERO_TOP },
|
||||
|
@@ -110,6 +110,22 @@ void CExchangeController::moveStack(bool leftToRight, SlotID sourceSlot)
|
||||
}
|
||||
}
|
||||
|
||||
void CExchangeController::moveSingleStackCreature(bool leftToRight, SlotID sourceSlot, bool forceEmptySlotTarget)
|
||||
{
|
||||
const auto source = leftToRight ? left : right;
|
||||
const auto target = leftToRight ? right : left;
|
||||
auto creature = source->getCreature(sourceSlot);
|
||||
|
||||
if(creature == nullptr || source->stacksCount() == 1)
|
||||
return;
|
||||
|
||||
SlotID targetSlot = forceEmptySlotTarget ? target->getFreeSlot() : target->getSlotFor(creature);
|
||||
if(targetSlot.validSlot())
|
||||
{
|
||||
LOCPLINT->cb->splitStack(source, target, sourceSlot, targetSlot, target->getStackCount(targetSlot) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void CExchangeController::swapArtifacts(bool equipped, bool baclpack)
|
||||
{
|
||||
LOCPLINT->cb->bulkMoveArtifacts(left->id, right->id, true, equipped, baclpack);
|
||||
|
@@ -20,6 +20,7 @@ public:
|
||||
void swapArmy();
|
||||
void moveArmy(bool leftToRight, std::optional<SlotID> heldSlot);
|
||||
void moveStack(bool leftToRight, SlotID sourceSlot);
|
||||
void moveSingleStackCreature(bool leftToRight, SlotID sourceSlot, bool forceEmptySlotTarget);
|
||||
void swapArtifacts(bool equipped, bool baclpack);
|
||||
void moveArtifacts(bool leftToRight, bool equipped, bool baclpack);
|
||||
|
||||
|
@@ -163,8 +163,8 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
||||
if(queryID.getNum() > 0)
|
||||
quit->addCallback([=](){ LOCPLINT->cb->selectionMade(0, queryID); });
|
||||
|
||||
questlogButton[0] = std::make_shared<CButton>(Point( 10, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this), EShortcut::ADVENTURE_QUEST_LOG);
|
||||
questlogButton[1] = std::make_shared<CButton>(Point(740, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this), EShortcut::ADVENTURE_QUEST_LOG);
|
||||
questlogButton[0] = std::make_shared<CButton>(Point( 10, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
|
||||
questlogButton[1] = std::make_shared<CButton>(Point(740, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
|
||||
|
||||
Rect barRect(5, 578, 725, 18);
|
||||
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), barRect, 5, 578));
|
||||
@@ -268,6 +268,10 @@ void CExchangeWindow::creatureArrowButtonCallback(bool leftToRight, SlotID slotI
|
||||
{
|
||||
if (GH.isKeyboardAltDown())
|
||||
controller.moveArmy(leftToRight, slotId);
|
||||
else if (GH.isKeyboardCtrlDown())
|
||||
controller.moveSingleStackCreature(leftToRight, slotId, true);
|
||||
else if (GH.isKeyboardShiftDown())
|
||||
controller.moveSingleStackCreature(leftToRight, slotId, false);
|
||||
else
|
||||
controller.moveStack(leftToRight, slotId);
|
||||
}
|
||||
|
@@ -138,7 +138,7 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m
|
||||
searchBoxRectangle = std::make_shared<TransparentFilledRectangle>(r.resize(1), rectangleColor, borderColor);
|
||||
searchBoxDescription = std::make_shared<CLabel>(r.center().x, r.center().y, FONT_SMALL, ETextAlignment::CENTER, grayedColor, CGI->generaltexth->translate("vcmi.spellBook.search"));
|
||||
|
||||
searchBox = std::make_shared<CTextInput>(r, FONT_SMALL, ETextAlignment::CENTER, true);
|
||||
searchBox = std::make_shared<CTextInput>(r, FONT_SMALL, ETextAlignment::CENTER, false);
|
||||
searchBox->setCallback(std::bind(&CSpellWindow::searchInput, this));
|
||||
}
|
||||
|
||||
@@ -354,6 +354,14 @@ void CSpellWindow::fbattleSpellsb()
|
||||
computeSpellsPerArea();
|
||||
}
|
||||
|
||||
void CSpellWindow::toggleSearchBoxFocus()
|
||||
{
|
||||
if(searchBox != nullptr)
|
||||
{
|
||||
searchBox->hasFocus() ? searchBox->removeFocus() : searchBox->giveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void CSpellWindow::fmanaPtsb()
|
||||
{
|
||||
}
|
||||
@@ -546,6 +554,9 @@ void CSpellWindow::keyPressed(EShortcut key)
|
||||
case EShortcut::SPELLBOOK_TAB_ADVENTURE:
|
||||
fadvSpellsb();
|
||||
break;
|
||||
case EShortcut::SPELLBOOK_SEARCH_FOCUS:
|
||||
toggleSearchBoxFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -129,6 +129,7 @@ public:
|
||||
void fexitb();
|
||||
void fadvSpellsb();
|
||||
void fbattleSpellsb();
|
||||
void toggleSearchBoxFocus();
|
||||
void fmanaPtsb();
|
||||
|
||||
void fLcornerb();
|
||||
|
@@ -88,10 +88,10 @@
|
||||
"battleToggleQueue": "Z",
|
||||
"battleUseCreatureSpell": ["F", "G"],
|
||||
"battleWait": "W",
|
||||
"exchangeArmySwap": "F10",
|
||||
"exchangeArmySwap": ["F10", "Q"],
|
||||
"exchangeArmyToLeft": [],
|
||||
"exchangeArmyToRight": [],
|
||||
"exchangeArtifactsSwap": "F11",
|
||||
"exchangeArtifactsSwap": ["F11", "Q"],
|
||||
"exchangeArtifactsToLeft": [],
|
||||
"exchangeArtifactsToRight": [],
|
||||
"exchangeBackpackLeft": [],
|
||||
@@ -233,6 +233,7 @@
|
||||
"spectateTrackHero": [],
|
||||
"spellbookTabAdventure": "A",
|
||||
"spellbookTabCombat": "C",
|
||||
"spellbookSearchFocus": "Tab",
|
||||
"townOpenFort": "F",
|
||||
"townOpenGarrisonedHero": "Shift+H",
|
||||
"townOpenHall": "B",
|
||||
|
Reference in New Issue
Block a user