瀏覽代碼

virtual CWindowObject

SoundSSGood 1 年之前
父節點
當前提交
20471c9c2f

+ 2 - 2
client/CMakeLists.txt

@@ -122,7 +122,6 @@ set(client_SRCS
 	widgets/CArtifactsOfHeroAltar.cpp
 	widgets/CArtifactsOfHeroMarket.cpp
 	widgets/CArtifactsOfHeroBackpack.cpp
-	widgets/CWindowWithArtifacts.cpp
 	widgets/RadialMenu.cpp
 	widgets/markets/CAltarArtifacts.cpp
 	widgets/markets/CAltarCreatures.cpp
@@ -152,6 +151,7 @@ set(client_SRCS
 	windows/InfoWindows.cpp
 	windows/QuickRecruitmentWindow.cpp
 	windows/CHeroBackpackWindow.cpp
+	windows/CWindowWithArtifacts.cpp
 	windows/settings/GeneralOptionsTab.cpp
 	windows/settings/OtherOptionsTab.cpp
 	windows/settings/SettingsMainWindow.cpp
@@ -312,7 +312,6 @@ set(client_HEADERS
 	widgets/CArtifactsOfHeroAltar.h
 	widgets/CArtifactsOfHeroMarket.h
 	widgets/CArtifactsOfHeroBackpack.h
-	widgets/CWindowWithArtifacts.h
 	widgets/RadialMenu.h
 	widgets/markets/CAltarArtifacts.h
 	widgets/markets/CAltarCreatures.h
@@ -342,6 +341,7 @@ set(client_HEADERS
 	windows/InfoWindows.h
 	windows/QuickRecruitmentWindow.h
 	windows/CHeroBackpackWindow.h
+	windows/CWindowWithArtifacts.h
 	windows/settings/GeneralOptionsTab.h
 	windows/settings/OtherOptionsTab.h
 	windows/settings/SettingsMainWindow.h

+ 6 - 6
client/windows/CCastleInterface.cpp

@@ -1183,7 +1183,7 @@ void CTownInfo::showPopupWindow(const Point & cursorPosition)
 }
 
 CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInstance * from):
-	CStatusbarWindow(PLAYER_COLORED | BORDERED),
+	CWindowObject(PLAYER_COLORED | BORDERED),
 	town(Town)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
@@ -1459,7 +1459,7 @@ void CHallInterface::CBuildingBox::showPopupWindow(const Point & cursorPosition)
 }
 
 CHallInterface::CHallInterface(const CGTownInstance * Town):
-	CStatusbarWindow(PLAYER_COLORED | BORDERED, Town->town->clientInfo.hallBackground),
+	CWindowObject(PLAYER_COLORED | BORDERED, Town->town->clientInfo.hallBackground),
 	town(Town)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
@@ -1507,7 +1507,7 @@ CHallInterface::CHallInterface(const CGTownInstance * Town):
 }
 
 CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Building, EBuildingState state, bool rightClick):
-	CStatusbarWindow(PLAYER_COLORED | (rightClick ? RCLICK_POPUP : 0), ImagePath::builtin("TPUBUILD")),
+	CWindowObject(PLAYER_COLORED | (rightClick ? RCLICK_POPUP : 0), ImagePath::builtin("TPUBUILD")),
 	town(Town),
 	building(Building)
 {
@@ -1660,7 +1660,7 @@ void LabeledValue::hover(bool on)
 }
 
 CFortScreen::CFortScreen(const CGTownInstance * town):
-	CStatusbarWindow(PLAYER_COLORED | BORDERED, getBgName(town))
+	CWindowObject(PLAYER_COLORED | BORDERED, getBgName(town))
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 	ui32 fortSize = static_cast<ui32>(town->creatures.size());
@@ -1849,7 +1849,7 @@ void CFortScreen::RecruitArea::showPopupWindow(const Point & cursorPosition)
 }
 
 CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner, const ImagePath & imagename)
-	: CStatusbarWindow(BORDERED, imagename)
+	: CWindowObject(BORDERED, imagename)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 
@@ -1918,7 +1918,7 @@ void CMageGuildScreen::Scroll::hover(bool on)
 }
 
 CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, ArtifactID aid, ObjectInstanceID hid):
-	CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("TPSMITH"))
+	CWindowObject(PLAYER_COLORED, ImagePath::builtin("TPSMITH"))
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 

+ 1 - 10
client/windows/CHeroBackpackWindow.cpp

@@ -21,8 +21,7 @@
 #include "CPlayerInterface.h"
 
 CHeroBackpackWindow::CHeroBackpackWindow(const CGHeroInstance * hero, const std::vector<CArtifactsOfHeroPtr> & artsSets)
-	: CStatusbarWindow(0)
-	, CWindowWithArtifacts(&artsSets)
+	: CWindowWithArtifacts(&artsSets)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
 
@@ -49,15 +48,7 @@ void CHeroBackpackWindow::showAll(Canvas & to)
 	CMessage::drawBorder(PlayerColor(LOCPLINT->playerID), to, pos.w+28, pos.h+29, pos.x-14, pos.y-15);
 }
 
-void CHeroBackpackWindow::activate()
-{
-	if(const auto art = getPickedArtifact())
-		setCursorAnimation(*art);
-	CIntObject::activate();
-}
-
 CHeroQuickBackpackWindow::CHeroQuickBackpackWindow(const CGHeroInstance * hero, ArtifactPosition targetSlot)
-	: CWindowObject(0)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
 

+ 2 - 4
client/windows/CHeroBackpackWindow.h

@@ -9,8 +9,7 @@
  */
 #pragma once
 
-#include "../widgets/CWindowWithArtifacts.h"
-#include "CWindowObject.h"
+#include "CWindowWithArtifacts.h"
 
 class CFilledTexture;
 
@@ -26,10 +25,9 @@ protected:
 	const int windowMargin = 5;
 
 	void showAll(Canvas & to) override;
-	void activate() override;
 };
 
-class CHeroQuickBackpackWindow : public CWindowObject, public CWindowWithArtifacts
+class CHeroQuickBackpackWindow : public CWindowWithArtifacts
 {
 public:
 	CHeroQuickBackpackWindow(const CGHeroInstance * hero, ArtifactPosition targetSlot);

+ 1 - 8
client/windows/CHeroWindow.cpp

@@ -19,7 +19,6 @@
 #include "../CPlayerInterface.h"
 
 #include "../gui/CGuiHandler.h"
-#include "../gui/CursorHandler.h"
 #include "../gui/TextAlignment.h"
 #include "../gui/Shortcut.h"
 #include "../gui/WindowHandler.h"
@@ -71,7 +70,7 @@ CHeroSwitcher::CHeroSwitcher(CHeroWindow * owner_, Point pos_, const CGHeroInsta
 }
 
 CHeroWindow::CHeroWindow(const CGHeroInstance * hero)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("HeroScr4"))
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("HeroScr4"))
 {
 	auto & heroscrn = CGI->generaltexth->heroscrn;
 
@@ -360,9 +359,3 @@ bool CHeroWindow::holdsGarrison(const CArmedInstance * army)
 {
 	return army == curHero;
 }
-
-void CHeroWindow::deactivate()
-{
-	CCS->curh->dragAndDropCursor(nullptr);
-	CIntObject::deactivate();
-}

+ 1 - 3
client/windows/CHeroWindow.h

@@ -9,8 +9,7 @@
  */
 #pragma once
 
-#include "../widgets/CWindowWithArtifacts.h"
-#include "CWindowObject.h"
+#include "CWindowWithArtifacts.h"
 
 #include "../../lib/bonuses/IBonusBearer.h"
 
@@ -108,7 +107,6 @@ public:
 	void switchHero(); //changes displayed hero
 	void updateGarrisons() override;
 	bool holdsGarrison(const CArmedInstance * army) override;
-	void deactivate() override;
 	void createBackpackWindow();
 
 	//friends

+ 19 - 53
client/windows/CKingdomInterface.cpp

@@ -19,7 +19,6 @@
 #include "../PlayerLocalState.h"
 #include "../adventureMap/CResDataBar.h"
 #include "../gui/CGuiHandler.h"
-#include "../gui/CursorHandler.h"
 #include "../gui/Shortcut.h"
 #include "../gui/WindowHandler.h"
 #include "../widgets/CComponent.h"
@@ -549,7 +548,10 @@ std::shared_ptr<CIntObject> CKingdomInterface::createMainTab(size_t index)
 	switch(index)
 	{
 	case 0:
-		return std::make_shared<CKingdHeroList>(size);
+		return std::make_shared<CKingdHeroList>(size, [this](const CWindowWithArtifacts::CArtifactsOfHeroPtr & newHeroSet)
+			{
+				addSetAndCallbacks(newHeroSet);
+			});
 	case 1:
 		return std::make_shared<CKingdTownList>(size);
 	default:
@@ -674,31 +676,7 @@ bool CKingdomInterface::holdsGarrison(const CArmedInstance * army)
 	return army->getOwner() == LOCPLINT->playerID;
 }
 
-void CKingdomInterface::artifactAssembled(const ArtifactLocation& artLoc)
-{
-	if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
-		arts->artifactAssembled(artLoc);
-}
-
-void CKingdomInterface::artifactDisassembled(const ArtifactLocation& artLoc)
-{
-	if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
-		arts->artifactDisassembled(artLoc);
-}
-
-void CKingdomInterface::artifactMoved(const ArtifactLocation& artLoc, const ArtifactLocation& destLoc, bool withRedraw)
-{
-	if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
-		arts->artifactMoved(artLoc, destLoc, withRedraw);
-}
-
-void CKingdomInterface::artifactRemoved(const ArtifactLocation& artLoc)
-{
-	if(auto arts = std::dynamic_pointer_cast<CWindowWithArtifacts>(tabArea->getItem()))
-		arts->artifactRemoved(artLoc);
-}
-
-CKingdHeroList::CKingdHeroList(size_t maxSize)
+CKingdHeroList::CKingdHeroList(size_t maxSize, const CreateHeroItemFunctor & onCreateHeroItemCallback)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 	title = std::make_shared<CPicture>(ImagePath::builtin("OVTITLE"),16,0);
@@ -708,8 +686,20 @@ CKingdHeroList::CKingdHeroList(size_t maxSize)
 
 	ui32 townCount = LOCPLINT->cb->howManyHeroes(false);
 	ui32 size = OVERVIEW_SIZE*116 + 19;
-	heroes = std::make_shared<CListBox>(std::bind(&CKingdHeroList::createHeroItem, this, _1),
-		Point(19,21), Point(0,116), maxSize, townCount, 0, 1, Rect(-19, -21, size, size));
+	heroes = std::make_shared<CListBox>([onCreateHeroItemCallback](size_t idx) -> std::shared_ptr<CIntObject>
+		{
+			auto heroesList = LOCPLINT->localState->getWanderingHeroes();
+			if(idx < heroesList.size())
+			{
+				auto hero = std::make_shared<CHeroItem>(heroesList[idx]);
+				onCreateHeroItemCallback(hero->heroArts);
+				return hero;
+			}
+			else
+			{
+				return std::make_shared<CAnimImage>(AnimationPath::builtin("OVSLOT"), (idx - 2) % GameConstants::KINGDOM_WINDOW_HEROES_SLOTS);
+			}
+		}, Point(19,21), Point(0,116), maxSize, townCount, 0, 1, Rect(-19, -21, size, size));
 }
 
 void CKingdHeroList::updateGarrisons()
@@ -730,30 +720,6 @@ bool CKingdHeroList::holdsGarrison(const CArmedInstance * army)
 	return false;
 }
 
-void CKingdHeroList::deactivate()
-{
-	CCS->curh->dragAndDropCursor(nullptr);
-	CIntObject::deactivate();
-}
-
-std::shared_ptr<CIntObject> CKingdHeroList::createHeroItem(size_t index)
-{
-	ui32 picCount = 4; // OVSLOT contains 4 images
-
-	auto heroesList = LOCPLINT->localState->getWanderingHeroes();
-
-	if(index < heroesList.size())
-	{
-		auto hero = std::make_shared<CHeroItem>(heroesList[index]);
-		//addSetAndCallbacks(hero->heroArts);
-		return hero;
-	}
-	else
-	{
-		return std::make_shared<CAnimImage>(AnimationPath::builtin("OVSLOT"), (index-2) % picCount );
-	}
-}
-
 CKingdTownList::CKingdTownList(size_t maxSize)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);

+ 4 - 10
client/windows/CKingdomInterface.h

@@ -9,8 +9,7 @@
  */
 #pragma once
 
-#include "../widgets/CWindowWithArtifacts.h"
-#include "CWindowObject.h"
+#include "CWindowWithArtifacts.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 class CGObjectInstance;
@@ -200,7 +199,7 @@ public:
 };
 
 /// Class which holds all parts of kingdom overview window
-class CKingdomInterface : public CWindowObject, public IGarrisonHolder, public CWindowWithArtifacts, public ITownHolder
+class CKingdomInterface : public IGarrisonHolder, public CWindowWithArtifacts, public ITownHolder
 {
 private:
 	struct OwnedObjectInfo
@@ -254,10 +253,6 @@ public:
 	void heroRemoved();
 	void updateGarrisons() override;
 	bool holdsGarrison(const CArmedInstance * army) override;
-	void artifactRemoved(const ArtifactLocation &artLoc) override;
-	void artifactMoved(const ArtifactLocation &artLoc, const ArtifactLocation &destLoc, bool withRedraw) override;
-	void artifactDisassembled(const ArtifactLocation &artLoc) override;
-	void artifactAssembled(const ArtifactLocation &artLoc) override;
 	void buildChanged() override;
 };
 
@@ -338,13 +333,12 @@ private:
 	std::shared_ptr<CLabel> heroLabel;
 	std::shared_ptr<CLabel> skillsLabel;
 
-	std::shared_ptr<CIntObject> createHeroItem(size_t index);
 public:
-	CKingdHeroList(size_t maxSize);
+	using CreateHeroItemFunctor = std::function<void(const CWindowWithArtifacts::CArtifactsOfHeroPtr)>;
 
+	CKingdHeroList(size_t maxSize, const CreateHeroItemFunctor & onCreateHeroItemCallback);
 	void updateGarrisons() override;
 	bool holdsGarrison(const CArmedInstance * army) override;
-	void deactivate() override;
 };
 
 /// Tab with all town-specific data

+ 1 - 8
client/windows/CMarketWindow.cpp

@@ -12,7 +12,6 @@
 #include "CMarketWindow.h"
 
 #include "../gui/CGuiHandler.h"
-#include "../gui/CursorHandler.h"
 #include "../gui/Shortcut.h"
 
 #include "../widgets/Buttons.h"
@@ -34,7 +33,7 @@
 #include "../../lib/mapObjects/CGHeroInstance.h"
 
 CMarketWindow::CMarketWindow(const IMarket * market, const CGHeroInstance * hero, const std::function<void()> & onWindowClosed, EMarketMode mode)
-	: CStatusbarWindow(PLAYER_COLORED)
+	: CWindowObject(PLAYER_COLORED)
 	, windowClosedCallback(onWindowClosed)
 {
 	assert(mode == EMarketMode::RESOURCE_RESOURCE || mode == EMarketMode::RESOURCE_PLAYER || mode == EMarketMode::CREATURE_RESOURCE ||
@@ -262,9 +261,3 @@ void CMarketWindow::createAltarCreatures(const IMarket * market, const CGHeroIns
 	initWidgetInternals(EMarketMode::CREATURE_EXP, CGI->generaltexth->zelp[568]);
 	updateHero();
 }
-
-void CMarketWindow::deactivate()
-{
-	CCS->curh->dragAndDropCursor(nullptr);
-	CIntObject::deactivate();
-}

+ 1 - 3
client/windows/CMarketWindow.h

@@ -10,8 +10,7 @@
 #pragma once
 
 #include "../widgets/markets/CMarketBase.h"
-#include "../widgets/CWindowWithArtifacts.h"
-#include "CWindowObject.h"
+#include "CWindowWithArtifacts.h"
 
 class CMarketWindow : public CStatusbarWindow, public CWindowWithArtifacts, public IGarrisonHolder
 {
@@ -25,7 +24,6 @@ public:
 	bool holdsGarrison(const CArmedInstance * army) override;
 	void artifactRemoved(const ArtifactLocation & artLoc) override;
 	void artifactMoved(const ArtifactLocation & srcLoc, const ArtifactLocation & destLoc, bool withRedraw) override;
-	void deactivate() override;
 
 private:
 	void createChangeModeButtons(EMarketMode currentMode, const IMarket * market, const CGHeroInstance * hero);

+ 0 - 8
client/windows/CWindowObject.cpp

@@ -239,11 +239,3 @@ bool CWindowObject::isPopupWindow() const
 {
 	return options & RCLICK_POPUP;
 }
-
-CStatusbarWindow::CStatusbarWindow(int options, const ImagePath & imageName, Point centerAt) : CWindowObject(options, imageName, centerAt)
-{
-}
-
-CStatusbarWindow::CStatusbarWindow(int options, const ImagePath & imageName) : CWindowObject(options, imageName)
-{
-}

+ 2 - 5
client/windows/CWindowObject.h

@@ -47,17 +47,14 @@ public:
 	 * centerAt - position of window center. Default - center of the screen
 	*/
 	CWindowObject(int options, const ImagePath & imageName, Point centerAt);
-	CWindowObject(int options, const ImagePath & imageName = {});
+	CWindowObject(int options = 0, const ImagePath & imageName = {});
 	~CWindowObject();
 
 	void showAll(Canvas & to) override;
 };
 
-class CStatusbarWindow : public CWindowObject
+class CStatusbarWindow : virtual public CWindowObject
 {
-public:
-	CStatusbarWindow(int options, const ImagePath & imageName, Point centerAt);
-	CStatusbarWindow(int options, const ImagePath & imageName = {});
 protected:
 	std::shared_ptr<CGStatusBar> statusbar;
 };

+ 14 - 1
client/widgets/CWindowWithArtifacts.cpp → client/windows/CWindowWithArtifacts.cpp

@@ -18,7 +18,7 @@
 #include "../render/CAnimation.h"
 #include "../render/IImage.h"
 
-#include "CComponent.h"
+#include "../widgets/CComponent.h"
 
 #include "../windows/CHeroWindow.h"
 #include "../windows/CSpellWindow.h"
@@ -333,6 +333,19 @@ void CWindowWithArtifacts::gestureArtPlaceHero(CArtifactsOfHeroBase & artsInst,
 		}, artSetWeak.value());
 }
 
+void CWindowWithArtifacts::activate()
+{
+	if(const auto art = getPickedArtifact())
+		setCursorAnimation(*art);
+	CWindowObject::activate();
+}
+
+void CWindowWithArtifacts::deactivate()
+{
+	CCS->curh->dragAndDropCursor(nullptr);
+	CWindowObject::deactivate();
+}
+
 void CWindowWithArtifacts::artifactRemoved(const ArtifactLocation & artLoc)
 {
 	updateSlots();

+ 9 - 6
client/widgets/CWindowWithArtifacts.h → client/windows/CWindowWithArtifacts.h

@@ -9,13 +9,14 @@
  */
 #pragma once
 
-#include "CArtifactsOfHeroMain.h"
-#include "CArtifactsOfHeroKingdom.h"
-#include "CArtifactsOfHeroAltar.h"
-#include "CArtifactsOfHeroMarket.h"
-#include "CArtifactsOfHeroBackpack.h"
+#include "../widgets/CArtifactsOfHeroMain.h"
+#include "../widgets/CArtifactsOfHeroKingdom.h"
+#include "../widgets/CArtifactsOfHeroAltar.h"
+#include "../widgets/CArtifactsOfHeroMarket.h"
+#include "../widgets/CArtifactsOfHeroBackpack.h"
+#include "CWindowObject.h"
 
-class CWindowWithArtifacts
+class CWindowWithArtifacts : virtual public CWindowObject
 {
 public:
 	using CArtifactsOfHeroPtr = std::variant<
@@ -36,6 +37,8 @@ public:
 	void clickPressedArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
 	void showPopupArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
 	void gestureArtPlaceHero(CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition);
+	void activate() override;
+	void deactivate() override;
 
 	virtual void artifactRemoved(const ArtifactLocation & artLoc);
 	virtual void artifactMoved(const ArtifactLocation & srcLoc, const ArtifactLocation & destLoc, bool withRedraw);

+ 9 - 15
client/windows/GUIClasses.cpp

@@ -204,7 +204,7 @@ void CRecruitmentWindow::showAll(Canvas & to)
 }
 
 CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID,int)> & Recruit, const std::function<void()> & onClose, int y_offset):
-	CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("TPRCRT")),
+	CWindowObject(PLAYER_COLORED, ImagePath::builtin("TPRCRT")),
 	onRecruit(Recruit),
 	onClose(onClose),
 	level(Level),
@@ -445,7 +445,7 @@ CLevelWindow::~CLevelWindow()
 }
 
 CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj, const std::function<void()> & onWindowClosed)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("TPTAVERN")),
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("TPTAVERN")),
 	onWindowClosed(onWindowClosed),
 	tavernObj(TavernObj),
 	heroToInvite(nullptr)
@@ -692,7 +692,7 @@ static bool isQuickExchangeLayoutAvailable()
 }
 
 CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID queryID)
-	: CStatusbarWindow(PLAYER_COLORED | BORDERED, ImagePath::builtin(isQuickExchangeLayoutAvailable() ? QUICK_EXCHANGE_BG : "TRADE2")),
+	: CWindowObject(PLAYER_COLORED | BORDERED, ImagePath::builtin(isQuickExchangeLayoutAvailable() ? QUICK_EXCHANGE_BG : "TRADE2")),
 	controller(hero1, hero2),
 	moveStackLeftButtons(),
 	moveStackRightButtons()
@@ -934,12 +934,6 @@ bool CExchangeWindow::holdsGarrison(const CArmedInstance * army)
 	return garr->upperArmy() == army || garr->lowerArmy() == army;
 }
 
-void CExchangeWindow::deactivate()
-{
-	CCS->curh->dragAndDropCursor(nullptr);
-	CIntObject::deactivate();
-}
-
 void CExchangeWindow::questlog(int whichHero)
 {
 	CCS->curh->dragAndDropCursor(nullptr);
@@ -975,7 +969,7 @@ void CExchangeWindow::updateWidgets()
 }
 
 CShipyardWindow::CShipyardWindow(const TResources & cost, int state, BoatId boatType, const std::function<void()> & onBuy)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("TPSHIP"))
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("TPSHIP"))
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 
@@ -1093,7 +1087,7 @@ bool CTransformerWindow::holdsGarrison(const CArmedInstance * army)
 }
 
 CTransformerWindow::CTransformerWindow(const IMarket * _market, const CGHeroInstance * _hero, const std::function<void()> & onWindowClosed)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("SKTRNBK")),
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("SKTRNBK")),
 	hero(_hero),
 	onWindowClosed(onWindowClosed),
 	market(_market)
@@ -1192,7 +1186,7 @@ void CUniversityWindow::CItem::showAll(Canvas & to)
 }
 
 CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket * _market, const std::function<void()> & onWindowClosed)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("UNIVERS1")),
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("UNIVERS1")),
 	hero(_hero),
 	onWindowClosed(onWindowClosed),
 	market(_market)
@@ -1254,7 +1248,7 @@ void CUniversityWindow::makeDeal(SecondarySkill skill)
 
 
 CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * owner_, SecondarySkill SKILL, bool available)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("UNIVERS2.PCX")),
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("UNIVERS2.PCX")),
 	owner(owner_)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
@@ -1341,7 +1335,7 @@ bool CGarrisonWindow::holdsGarrison(const CArmedInstance * army)
 }
 
 CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectInstance * object)
-	: CStatusbarWindow(PLAYER_COLORED, ImagePath::builtin("APHLFTBK")),
+	: CWindowObject(PLAYER_COLORED, ImagePath::builtin("APHLFTBK")),
 	fort(object),
 	hero(visitor)
 {
@@ -1545,7 +1539,7 @@ int CHillFortWindow::getState(SlotID slot)
 }
 
 CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
-	CStatusbarWindow(PLAYER_COLORED | BORDERED, ImagePath::builtin("TpRank")),
+	CWindowObject(PLAYER_COLORED | BORDERED, ImagePath::builtin("TpRank")),
 	owner(_owner)
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);

+ 1 - 3
client/windows/GUIClasses.h

@@ -11,9 +11,8 @@
 
 #include "../lib/ResourceSet.h"
 #include "../widgets/CExchangeController.h"
-#include "../widgets/CWindowWithArtifacts.h"
 #include "../widgets/Images.h"
-#include "../windows/CWindowObject.h"
+#include "CWindowWithArtifacts.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -326,7 +325,6 @@ public:
 
 	void updateGarrisons() override;
 	bool holdsGarrison(const CArmedInstance * army) override;
-	void deactivate() override;
 
 	void questlog(int whichHero); //questlog button callback; whichHero: 0 - left, 1 - right
 

+ 1 - 0
lib/constants/NumericConstants.h

@@ -53,6 +53,7 @@ namespace GameConstants
 	constexpr int64_t PLAYER_RESOURCES_CAP = 1000 * 1000 * 1000;
 	constexpr int ALTAR_ARTIFACTS_SLOTS = 22;
 	constexpr int TOURNAMENT_RULES_DD_MAP_TILES_THRESHOLD = 144*144*2; //map tiles count threshold for 2 dimension door casts with tournament rules
+	constexpr int KINGDOM_WINDOW_HEROES_SLOTS = 4;
 }
 
 VCMI_LIB_NAMESPACE_END