Browse Source

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

Ivan Savenko 1 year ago
parent
commit
dd337dba7b

+ 4 - 3
client/gui/InterfaceObjectConfigurable.cpp

@@ -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;

+ 1 - 1
client/gui/InterfaceObjectConfigurable.h

@@ -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;
 	};