1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-17 11:56:46 +02:00

Fixed Puzzle Map hotkey not working due to having inactive button in

world view mode
This commit is contained in:
Ivan Savenko 2024-05-19 08:23:28 +00:00
parent 0db8266495
commit dd337dba7b
2 changed files with 5 additions and 4 deletions

@ -492,7 +492,7 @@ void InterfaceObjectConfigurable::loadButtonHotkey(std::shared_ptr<CButton> butt
return;
button->addCallback(target->second.callback);
target->second.assignedToButton = true;
target->second.assignedButtons.push_back(button);
}
std::shared_ptr<CLabelGroup> InterfaceObjectConfigurable::buildLabelGroup(const JsonNode & config) const
@ -821,8 +821,9 @@ void InterfaceObjectConfigurable::keyPressed(EShortcut key)
if (target == shortcuts.end())
return;
if (target->second.assignedToButton)
return; // will be handled by button instance
for (auto const & button :target->second.assignedButtons)
if (button->isActive())
return; // will be handled by button instance
if (target->second.blocked)
return;

@ -118,7 +118,7 @@ private:
struct ShortcutState
{
std::function<void()> callback;
mutable bool assignedToButton = false;
mutable std::vector<std::shared_ptr<CButton>> assignedButtons;
bool blocked = false;
};