Jelajahi Sumber

Tavern also in infobox & haptics

Laserlicht 2 tahun lalu
induk
melakukan
b89cdda718
2 mengubah file dengan 14 tambahan dan 0 penghapusan
  1. 13 0
      client/widgets/MiscWidgets.cpp
  2. 1 0
      client/widgets/MiscWidgets.h

+ 13 - 0
client/widgets/MiscWidgets.cpp

@@ -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);

+ 1 - 0
client/widgets/MiscWidgets.h

@@ -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;