1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Show creature popup window on right-click in town fort

This commit is contained in:
Ivan Savenko 2023-07-30 15:29:18 +03:00
parent 397c4c7595
commit 5d2dd4c633
2 changed files with 11 additions and 0 deletions

View File

@ -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<CPicture>("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<CStackWindow>(getMyCreature(), true);
}
CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem)
: CStatusbarWindow(BORDERED, imagem)
{

View File

@ -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<CLabel> title;
std::vector<std::shared_ptr<RecruitArea>> recAreas;