diff --git a/client/lobby/SelectionTab.cpp b/client/lobby/SelectionTab.cpp index 5631c9d4d..730b29e99 100644 --- a/client/lobby/SelectionTab.cpp +++ b/client/lobby/SelectionTab.cpp @@ -358,6 +358,17 @@ void SelectionTab::clickDouble(const Point & cursorPosition) if(itemIndex >= curItems.size()) return; + auto clickedItem = curItems[itemIndex]; + auto selectedItem = getSelectedMapInfo(); + + if (clickedItem != selectedItem) + { + // double-click BUT player hit different item than he had selected + // ignore - clickReleased would still trigger and update selection. + // After which another (3rd) click if it happens would still register as double-click + return; + } + if(itemIndex >= 0 && curItems[itemIndex]->isFolder) { select(position); diff --git a/client/widgets/CComponent.cpp b/client/widgets/CComponent.cpp index d90efdd3a..043dde6fa 100644 --- a/client/widgets/CComponent.cpp +++ b/client/widgets/CComponent.cpp @@ -335,8 +335,15 @@ void CSelectableComponent::clickPressed(const Point & cursorPosition) void CSelectableComponent::clickDouble(const Point & cursorPosition) { - if(onChoose) - onChoose(); + if (!selected) + { + clickPressed(cursorPosition); + } + else + { + if (onChoose) + onChoose(); + } } void CSelectableComponent::init() diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 2ad3e0984..985b23a1c 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -616,6 +616,9 @@ void CTavernWindow::HeroPortrait::clickDouble(const Point & cursorPosition) void CTavernWindow::HeroPortrait::showPopupWindow(const Point & cursorPosition) { + // h3 behavior - right-click also selects hero + clickPressed(cursorPosition); + if(h) GH.windows().createAndPushWindow(std::make_shared(h)); } @@ -1712,6 +1715,12 @@ void CObjectListWindow::CItem::clickPressed(const Point & cursorPosition) void CObjectListWindow::CItem::clickDouble(const Point & cursorPosition) { + if (parent->selected != index) + { + clickPressed(cursorPosition); + return; + } + parent->elementSelected(); }