1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

Tavern also in infobox & haptics

This commit is contained in:
Laserlicht 2023-10-13 23:36:51 +02:00 committed by GitHub
parent 5a84e7cd7f
commit b89cdda718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "../CGameInfo.h"
#include "../PlayerLocalState.h"
#include "../gui/WindowHandler.h"
#include "../eventsSDL/InputHandler.h"
#include "../windows/CTradeWindow.h"
#include "../widgets/TextControls.h"
#include "../widgets/CGarrisonInt.h"
@ -180,7 +181,10 @@ LRClickableAreaOpenTown::LRClickableAreaOpenTown(const Rect & Pos, const CGTownI
void LRClickableArea::clickPressed(const Point & cursorPosition)
{
if(onClick)
{
onClick();
GH.input().hapticFeedback();
}
}
void LRClickableArea::showPopupWindow(const Point & cursorPosition)
@ -447,6 +451,15 @@ void CInteractableTownTooltip::init(const CGTownInstance * town)
std::make_shared<CCastleBuildings>(town)->enterToTheQuickRecruitmentWindow();
}
});
fastTavern = std::make_shared<LRClickableArea>(Rect(3, 2, 58, 64), [townId]()
{
std::vector<const CGTownInstance*> towns = LOCPLINT->cb->getTownsInfo(true);
for(auto & town : towns)
{
if(town->id == townId && town->builtBuildings.count(BuildingID::TAVERN))
LOCPLINT->showTavernWindow(town, nullptr, QueryID::NONE);
}
});
fastMarket = std::make_shared<LRClickableArea>(Rect(143, 31, 30, 34), []()
{
std::vector<const CGTownInstance*> towns = LOCPLINT->cb->getTownsInfo(true);

View File

@ -135,6 +135,7 @@ class CInteractableTownTooltip : public CIntObject
std::shared_ptr<CAnimImage> res2;
std::shared_ptr<CGarrisonInt> garrison;
std::shared_ptr<LRClickableArea> fastTavern;
std::shared_ptr<LRClickableArea> fastMarket;
std::shared_ptr<LRClickableArea> fastTownHall;
std::shared_ptr<LRClickableArea> fastArmyPurchase;