瀏覽代碼

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

Ivan Savenko 1 年之前
父節點
當前提交
dd337dba7b
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 4 3
      client/gui/InterfaceObjectConfigurable.cpp
  2. 1 1
      client/gui/InterfaceObjectConfigurable.h

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