From 890c4ac19dbe378c766f2c95c51e86c989392765 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:11:06 +0200 Subject: [PATCH 1/3] quick army managment click next --- client/adventureMap/CInfoBar.cpp | 5 ----- client/gui/EventDispatcher.cpp | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/client/adventureMap/CInfoBar.cpp b/client/adventureMap/CInfoBar.cpp index bdcf76766..7b0f7628f 100644 --- a/client/adventureMap/CInfoBar.cpp +++ b/client/adventureMap/CInfoBar.cpp @@ -295,12 +295,7 @@ void CInfoBar::clickReleased(const Point & cursorPosition) removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore if(state == HERO || state == TOWN) - { - if(settings["gameTweaks"]["infoBarCreatureManagement"].Bool()) - return; - showGameStatus(); - } else if(state == GAME) showDate(); else diff --git a/client/gui/EventDispatcher.cpp b/client/gui/EventDispatcher.cpp index 3dc576f5e..08e4c6b44 100644 --- a/client/gui/EventDispatcher.cpp +++ b/client/gui/EventDispatcher.cpp @@ -218,6 +218,7 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc i->clickReleased(position); i->mouseClickedState = isPressed; + return; } else { From 53ee843e7e754e9511574dff69346f64d1eb0f8d Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Oct 2023 22:33:22 +0200 Subject: [PATCH 2/3] fixes problem with radial menu --- client/adventureMap/AdventureMapInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index 7bd085cd5..376401437 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -24,6 +24,7 @@ #include "../mapView/mapHandler.h" #include "../mapView/MapView.h" #include "../windows/InfoWindows.h" +#include "../widgets/RadialMenu.h" #include "../CGameInfo.h" #include "../gui/CursorHandler.h" #include "../gui/CGuiHandler.h" @@ -169,8 +170,7 @@ void AdventureMapInterface::dim(Canvas & to) { for (auto window : GH.windows().findWindows()) { - std::shared_ptr casted = std::dynamic_pointer_cast(window); - if (!casted && !window->isPopupWindow()) + if (!std::dynamic_pointer_cast(window) && !std::dynamic_pointer_cast(window) && !window->isPopupWindow()) { Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y); ColorRGBA colorToFill(0, 0, 0, std::clamp(backgroundDimLevel, 0, 255)); From f9db3d131ffcb4ce7d90f34247949c9ebe1935fb Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:51:05 +0200 Subject: [PATCH 3/3] lastActivated with overload --- client/adventureMap/CInfoBar.cpp | 7 +++++-- client/adventureMap/CInfoBar.h | 2 +- client/gui/EventDispatcher.cpp | 9 ++++++++- client/gui/EventsReceiver.h | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/adventureMap/CInfoBar.cpp b/client/adventureMap/CInfoBar.cpp index 7b0f7628f..360dd4946 100644 --- a/client/adventureMap/CInfoBar.cpp +++ b/client/adventureMap/CInfoBar.cpp @@ -289,13 +289,16 @@ void CInfoBar::tick(uint32_t msPassed) } } -void CInfoBar::clickReleased(const Point & cursorPosition) +void CInfoBar::clickReleased(const Point & cursorPosition, bool lastActivated) { timerCounter = 0; removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore if(state == HERO || state == TOWN) - showGameStatus(); + { + if(lastActivated) + showGameStatus(); + } else if(state == GAME) showDate(); else diff --git a/client/adventureMap/CInfoBar.h b/client/adventureMap/CInfoBar.h index 8dc8c88cb..5800377b7 100644 --- a/client/adventureMap/CInfoBar.h +++ b/client/adventureMap/CInfoBar.h @@ -159,7 +159,7 @@ private: void tick(uint32_t msPassed) override; - void clickReleased(const Point & cursorPosition) override; + void clickReleased(const Point & cursorPosition, bool lastActivated) override; void showPopupWindow(const Point & cursorPosition) override; void hover(bool on) override; diff --git a/client/gui/EventDispatcher.cpp b/client/gui/EventDispatcher.cpp index 08e4c6b44..721954848 100644 --- a/client/gui/EventDispatcher.cpp +++ b/client/gui/EventDispatcher.cpp @@ -203,6 +203,7 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc // POSSIBLE SOLUTION: make EventReceivers inherit from create_shared_from this and store weak_ptr's in lists AEventsReceiver * nearestElement = findElementInToleranceRange(lclickable, position, AEventsReceiver::LCLICK, tolerance); auto hlp = lclickable; + bool lastActivated = true; for(auto & i : hlp) { @@ -212,13 +213,19 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement) { if(isPressed) + { i->clickPressed(position); + i->clickPressed(position, lastActivated); + } if (i->mouseClickedState && !isPressed) + { i->clickReleased(position); + i->clickReleased(position, lastActivated); + } i->mouseClickedState = isPressed; - return; + lastActivated = false; } else { diff --git a/client/gui/EventsReceiver.h b/client/gui/EventsReceiver.h index 2206c70bf..690c9b9a8 100644 --- a/client/gui/EventsReceiver.h +++ b/client/gui/EventsReceiver.h @@ -45,6 +45,8 @@ protected: public: virtual void clickPressed(const Point & cursorPosition) {} virtual void clickReleased(const Point & cursorPosition) {} + virtual void clickPressed(const Point & cursorPosition, bool lastActivated) {} + virtual void clickReleased(const Point & cursorPosition, bool lastActivated) {} virtual void clickCancel(const Point & cursorPosition) {} virtual void showPopupWindow(const Point & cursorPosition) {} virtual void clickDouble(const Point & cursorPosition) {}