From 5d2dd4c633b82eee2d514965d7198a1786c18551 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 30 Jul 2023 15:29:18 +0300 Subject: [PATCH] Show creature popup window on right-click in town fort --- client/windows/CCastleInterface.cpp | 9 +++++++++ client/windows/CCastleInterface.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index e3f743aec..dda745cea 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -15,6 +15,7 @@ #include "InfoWindows.h" #include "GUIClasses.h" #include "QuickRecruitmentWindow.h" +#include "CCreatureWindow.h" #include "../CGameInfo.h" #include "../CMusicHandler.h" @@ -1653,6 +1654,8 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance * if(!town->creatures[level].second.empty()) addUsedEvents(LCLICK | HOVER);//Activate only if dwelling is present + addUsedEvents(SHOW_POPUP); + icons = std::make_shared("TPCAINFO", 261, 3); if(getMyBuilding() != nullptr) @@ -1740,6 +1743,12 @@ void CFortScreen::RecruitArea::clickPressed(const Point & cursorPosition) LOCPLINT->castleInt->builds->enterDwelling(level); } +void CFortScreen::RecruitArea::showPopupWindow(const Point & cursorPosition) +{ + if (getMyCreature() != nullptr) + GH.windows().createAndPushWindow(getMyCreature(), true); +} + CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem) : CStatusbarWindow(BORDERED, imagem) { diff --git a/client/windows/CCastleInterface.h b/client/windows/CCastleInterface.h index 05ea80fe1..d3bbc29ae 100644 --- a/client/windows/CCastleInterface.h +++ b/client/windows/CCastleInterface.h @@ -347,6 +347,8 @@ class CFortScreen : public CStatusbarWindow void creaturesChangedEventHandler(); void hover(bool on) override; void clickPressed(const Point & cursorPosition) override; + void showPopupWindow(const Point & cursorPosition) override; + }; std::shared_ptr title; std::vector> recAreas;