瀏覽代碼

Renamed "Int" -> "Window" in WindowHandler API

Ivan Savenko 2 年之前
父節點
當前提交
e2ef136003

+ 3 - 3
client/CMT.cpp

@@ -524,14 +524,14 @@ static void handleEvent(SDL_Event & ev)
 				{
 					if(ourCampaign->mapsRemaining.size())
 					{
-						GH.windows().pushInt(CMM);
-						GH.windows().pushInt(CMM->menu);
+						GH.windows().pushWindow(CMM);
+						GH.windows().pushWindow(CMM->menu);
 						CMM->openCampaignLobby(ourCampaign);
 					}
 				};
 				if(epilogue.hasPrologEpilog)
 				{
-					GH.windows().pushIntT<CPrologEpilogVideo>(epilogue, finisher);
+					GH.windows().createAndPushWindow<CPrologEpilogVideo>(epilogue, finisher);
 				}
 				else
 				{

+ 46 - 46
client/CPlayerInterface.cpp

@@ -170,16 +170,16 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 
-	if(GH.windows().findInts<AdventureMapInterface>().empty())
+	if(GH.windows().findWindows<AdventureMapInterface>().empty())
 	{
 		// after map load - remove all active windows and replace them with adventure map
 		GH.windows().clear();
-		GH.windows().pushInt(adventureInt);
+		GH.windows().pushWindow(adventureInt);
 	}
 
 	// remove all dialogs that do not expect query answer
-	while (GH.windows().topInt() != adventureInt && !dynamic_cast<CInfoWindow*>(GH.windows().topInt().get()))
-		GH.windows().popInts(1);
+	while (GH.windows().topWindow() != adventureInt && !dynamic_cast<CInfoWindow*>(GH.windows().topWindow().get()))
+		GH.windows().popWindows(1);
 
 	if (player != playerID && LOCPLINT == this)
 	{
@@ -247,7 +247,7 @@ void CPlayerInterface::acceptTurn()
 {
 	if (settings["session"]["autoSkip"].Bool())
 	{
-		while(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.windows().topInt().get()))
+		while(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.windows().topWindow().get()))
 			iw->close();
 	}
 
@@ -441,7 +441,7 @@ void CPlayerInterface::openTownWindow(const CGTownInstance * town)
 
 	auto newCastleInt = std::make_shared<CCastleInterface>(town);
 
-	GH.windows().pushInt(newCastleInt);
+	GH.windows().pushWindow(newCastleInt);
 }
 
 void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int which, si64 val)
@@ -449,7 +449,7 @@ void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	if (which == 4)
 	{
-		if (CAltarWindow *ctw = dynamic_cast<CAltarWindow *>(GH.windows().topInt().get()))
+		if (CAltarWindow *ctw = dynamic_cast<CAltarWindow *>(GH.windows().topWindow().get()))
 			ctw->setExpToLevel();
 	}
 	else
@@ -459,7 +459,7 @@ void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int
 void CPlayerInterface::heroSecondarySkillChanged(const CGHeroInstance * hero, int which, int val)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	CUniversityWindow* cuw = dynamic_cast<CUniversityWindow*>(GH.windows().topInt().get());
+	CUniversityWindow* cuw = dynamic_cast<CUniversityWindow*>(GH.windows().topWindow().get());
 	if (cuw) //university window is open
 	{
 		GH.windows().totalRedraw();
@@ -482,7 +482,7 @@ void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
 void CPlayerInterface::receivedResource()
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	if (CMarketplaceWindow *mw = dynamic_cast<CMarketplaceWindow *>(GH.windows().topInt().get()))
+	if (CMarketplaceWindow *mw = dynamic_cast<CMarketplaceWindow *>(GH.windows().topWindow().get()))
 		mw->resourceChanged();
 
 	GH.windows().totalRedraw();
@@ -493,7 +493,7 @@ void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::Pr
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	waitWhileDialog();
 	CCS->soundh->playSound(soundBase::heroNewLevel);
-	GH.windows().pushIntT<CLevelWindow>(hero, pskill, skills, [=](ui32 selection)
+	GH.windows().createAndPushWindow<CLevelWindow>(hero, pskill, skills, [=](ui32 selection)
 	{
 		cb->selectionMade(selection, queryID);
 	});
@@ -504,7 +504,7 @@ void CPlayerInterface::commanderGotLevel (const CCommanderInstance * commander,
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	waitWhileDialog();
 	CCS->soundh->playSound(soundBase::heroNewLevel);
-	GH.windows().pushIntT<CStackWindow>(commander, skills, [=](ui32 selection)
+	GH.windows().createAndPushWindow<CStackWindow>(commander, skills, [=](ui32 selection)
 	{
 		cb->selectionMade(selection, queryID);
 	});
@@ -540,7 +540,7 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
 		castleInt->redraw();
 	}
 
-	for (auto ki : GH.windows().findInts<CKingdomInterface>())
+	for (auto ki : GH.windows().findWindows<CKingdomInterface>())
 	{
 		ki->townChanged(town);
 		ki->updateGarrisons();
@@ -589,10 +589,10 @@ void CPlayerInterface::garrisonsChanged(std::vector<const CGObjectInstance *> ob
 			adventureInt->onTownChanged(town);
 	}
 
-	for (auto cgh : GH.windows().findInts<CGarrisonHolder>())
+	for (auto cgh : GH.windows().findWindows<CGarrisonHolder>())
 		cgh->updateGarrisons();
 
-	for (auto cmw : GH.windows().findInts<CTradeWindow>())
+	for (auto cmw : GH.windows().findWindows<CTradeWindow>())
 	{
 		if (vstd::contains(objs, cmw->hero))
 			cmw->garrisonChanged();
@@ -857,7 +857,7 @@ void CPlayerInterface::battleEnd(const BattleResult *br, QueryID queryID)
 			{
 				cb->selectionMade(selection, queryID);
 			};
-			GH.windows().pushInt(wnd);
+			GH.windows().pushWindow(wnd);
 			// #1490 - during AI turn when quick combat is on, we need to display the message and wait for user to close it.
 			// Otherwise NewTurn causes freeze.
 			waitWhileDialog();
@@ -1057,7 +1057,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
 		CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID));
 		showingDialog->set(true);
 		stopMovement(); // interrupt movement to show dialog
-		GH.windows().pushInt(temp);
+		GH.windows().pushWindow(temp);
 	}
 	else
 	{
@@ -1117,7 +1117,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
 		int charperline = 35;
 		if (pom.size() > 1)
 			charperline = 50;
-		GH.windows().pushIntT<CSelWindow>(text, playerID, charperline, intComps, pom, askID);
+		GH.windows().createAndPushWindow<CSelWindow>(text, playerID, charperline, intComps, pom, askID);
 		intComps[0]->clickLeft(true, false);
 	}
 }
@@ -1166,7 +1166,7 @@ void CPlayerInterface::showMapObjectSelectDialog(QueryID askID, const Component
 
 	std::shared_ptr<CObjectListWindow> wnd = std::make_shared<CObjectListWindow>(tempList, localIcon, localTitle, localDescription, selectCallback);
 	wnd->onExit = cancelCallback;
-	GH.windows().pushInt(wnd);
+	GH.windows().pushWindow(wnd);
 }
 
 void CPlayerInterface::tileRevealed(const std::unordered_set<int3> &pos)
@@ -1185,7 +1185,7 @@ void CPlayerInterface::tileHidden(const std::unordered_set<int3> &pos)
 void CPlayerInterface::openHeroWindow(const CGHeroInstance *hero)
 {
 	boost::unique_lock<boost::recursive_mutex> un(*pim);
-	GH.windows().pushIntT<CHeroWindow>(hero);
+	GH.windows().createAndPushWindow<CHeroWindow>(hero);
 }
 
 void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
@@ -1193,8 +1193,8 @@ void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	if (const CGTownInstance * townObj = dynamic_cast<const CGTownInstance*>(town))
 	{
-		CFortScreen * fortScreen = dynamic_cast<CFortScreen*>(GH.windows().topInt().get());
-		CCastleInterface * castleInterface = dynamic_cast<CCastleInterface*>(GH.windows().topInt().get());
+		CFortScreen * fortScreen = dynamic_cast<CFortScreen*>(GH.windows().topWindow().get());
+		CCastleInterface * castleInterface = dynamic_cast<CCastleInterface*>(GH.windows().topWindow().get());
 
 		if (fortScreen)
 			fortScreen->creaturesChangedEventHandler();
@@ -1202,13 +1202,13 @@ void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
 			castleInterface->creaturesChangedEventHandler();
 
 		if (townObj)
-			for (auto ki : GH.windows().findInts<CKingdomInterface>())
+			for (auto ki : GH.windows().findWindows<CKingdomInterface>())
 				ki->townChanged(townObj);
 	}
 	else if(town && GH.windows().count() > 0 && (town->ID == Obj::CREATURE_GENERATOR1
 		||  town->ID == Obj::CREATURE_GENERATOR4  ||  town->ID == Obj::WAR_MACHINE_FACTORY))
 	{
-		CRecruitmentWindow *crw = dynamic_cast<CRecruitmentWindow*>(GH.windows().topInt().get());
+		CRecruitmentWindow *crw = dynamic_cast<CRecruitmentWindow*>(GH.windows().topWindow().get());
 		if (crw && crw->dwelling == town)
 			crw->availableCreaturesChanged();
 	}
@@ -1276,7 +1276,7 @@ void CPlayerInterface::showGarrisonDialog( const CArmedInstance *up, const CGHer
 
 	auto cgw = std::make_shared<CGarrisonWindow>(up, down, removableUnits);
 	cgw->quit->addCallback(onEnd);
-	GH.windows().pushInt(cgw);
+	GH.windows().pushWindow(cgw);
 }
 
 /**
@@ -1334,7 +1334,7 @@ void CPlayerInterface::showHeroExchange(ObjectInstanceID hero1, ObjectInstanceID
 void CPlayerInterface::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID query)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CExchangeWindow>(hero1, hero2, query);
+	GH.windows().createAndPushWindow<CExchangeWindow>(hero1, hero2, query);
 }
 
 void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
@@ -1395,7 +1395,7 @@ void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, const C
 	{
 		LOCPLINT->cb->recruitCreatures(dwelling, dst, id, count, -1);
 	};
-	GH.windows().pushIntT<CRecruitmentWindow>(dwelling, level, dst, recruitCb);
+	GH.windows().createAndPushWindow<CRecruitmentWindow>(dwelling, level, dst, recruitCb);
 }
 
 void CPlayerInterface::waitWhileDialog(bool unlockPim)
@@ -1418,7 +1418,7 @@ void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
 	auto state = obj->shipyardStatus();
 	TResources cost;
 	obj->getBoatCost(cost);
-	GH.windows().pushIntT<CShipyardWindow>(cost, state, obj->getBoatType(), [=](){ cb->buildBoat(obj); });
+	GH.windows().createAndPushWindow<CShipyardWindow>(cost, state, obj->getBoatType(), [=](){ cb->buildBoat(obj); });
 }
 
 void CPlayerInterface::newObject( const CGObjectInstance * obj )
@@ -1511,7 +1511,7 @@ void CPlayerInterface::update()
 	if ((CSH->howManyPlayerInterfaces() <= 1 || makingTurn) && !dialogs.empty() && !showingDialog->get())
 	{
 		showingDialog->set(true);
-		GH.windows().pushInt(dialogs.front());
+		GH.windows().pushWindow(dialogs.front());
 		dialogs.pop_front();
 	}
 
@@ -1586,7 +1586,7 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
 			if(adventureInt)
 			{
 				GH.terminate_cond->setn(true);
-				GH.windows().popInts(GH.windows().count());
+				GH.windows().popWindows(GH.windows().count());
 				adventureInt.reset();
 			}
 		}
@@ -1632,7 +1632,7 @@ void CPlayerInterface::showPuzzleMap()
 	double ratio = 0;
 	int3 grailPos = cb->getGrailPos(&ratio);
 
-	GH.windows().pushIntT<CPuzzleWindow>(grailPos, ratio);
+	GH.windows().createAndPushWindow<CPuzzleWindow>(grailPos, ratio);
 }
 
 void CPlayerInterface::viewWorldMap()
@@ -1644,8 +1644,8 @@ void CPlayerInterface::advmapSpellCast(const CGHeroInstance * caster, int spellI
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 
-	if(dynamic_cast<CSpellWindow *>(GH.windows().topInt().get()))
-		GH.windows().popInts(1);
+	if(dynamic_cast<CSpellWindow *>(GH.windows().topWindow().get()))
+		GH.windows().popWindows(1);
 
 	if(spellID == SpellID::FLY || spellID == SpellID::WATER_WALK)
 		localState->erasePath(caster);
@@ -1707,50 +1707,50 @@ void CPlayerInterface::showMarketWindow(const IMarket *market, const CGHeroInsta
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 
 	if(market->allowsTrade(EMarketMode::ARTIFACT_EXP) && visitor->getAlignment() != EAlignment::EVIL)
-		GH.windows().pushIntT<CAltarWindow>(market, visitor, EMarketMode::ARTIFACT_EXP);
+		GH.windows().createAndPushWindow<CAltarWindow>(market, visitor, EMarketMode::ARTIFACT_EXP);
 	else if(market->allowsTrade(EMarketMode::CREATURE_EXP) && visitor->getAlignment() != EAlignment::GOOD)
-		GH.windows().pushIntT<CAltarWindow>(market, visitor, EMarketMode::CREATURE_EXP);
+		GH.windows().createAndPushWindow<CAltarWindow>(market, visitor, EMarketMode::CREATURE_EXP);
 	else if(market->allowsTrade(EMarketMode::CREATURE_UNDEAD))
-		GH.windows().pushIntT<CTransformerWindow>(market, visitor);
+		GH.windows().createAndPushWindow<CTransformerWindow>(market, visitor);
 	else if(!market->availableModes().empty())
-		GH.windows().pushIntT<CMarketplaceWindow>(market, visitor, market->availableModes().front());
+		GH.windows().createAndPushWindow<CMarketplaceWindow>(market, visitor, market->availableModes().front());
 }
 
 void CPlayerInterface::showUniversityWindow(const IMarket *market, const CGHeroInstance *visitor)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CUniversityWindow>(visitor, market);
+	GH.windows().createAndPushWindow<CUniversityWindow>(visitor, market);
 }
 
 void CPlayerInterface::showHillFortWindow(const CGObjectInstance *object, const CGHeroInstance *visitor)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CHillFortWindow>(visitor, object);
+	GH.windows().createAndPushWindow<CHillFortWindow>(visitor, object);
 }
 
 void CPlayerInterface::availableArtifactsChanged(const CGBlackMarket * bm)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	if (CMarketplaceWindow *cmw = dynamic_cast<CMarketplaceWindow*>(GH.windows().topInt().get()))
+	if (CMarketplaceWindow *cmw = dynamic_cast<CMarketplaceWindow*>(GH.windows().topWindow().get()))
 		cmw->artifactsChanged(false);
 }
 
 void CPlayerInterface::showTavernWindow(const CGObjectInstance *townOrTavern)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CTavernWindow>(townOrTavern);
+	GH.windows().createAndPushWindow<CTavernWindow>(townOrTavern);
 }
 
 void CPlayerInterface::showThievesGuildWindow (const CGObjectInstance * obj)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CThievesGuildWindow>(obj);
+	GH.windows().createAndPushWindow<CThievesGuildWindow>(obj);
 }
 
 void CPlayerInterface::showQuestLog()
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
-	GH.windows().pushIntT<CQuestLog>(LOCPLINT->cb->getMyQuests());
+	GH.windows().createAndPushWindow<CQuestLog>(LOCPLINT->cb->getMyQuests());
 }
 
 void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
@@ -1802,7 +1802,7 @@ void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)
 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
 	adventureInt->onHeroChanged(hero);
 
-	for(auto artWin : GH.windows().findInts<CArtifactHolder>())
+	for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
 		artWin->artifactRemoved(al);
 
 	waitWhileDialog();
@@ -1823,7 +1823,7 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
 			redraw = false;
 	}
 
-	for(auto artWin : GH.windows().findInts<CArtifactHolder>())
+	for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
 		artWin->artifactMoved(src, dst, redraw);
 
 	waitWhileDialog();
@@ -1840,7 +1840,7 @@ void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
 	adventureInt->onHeroChanged(hero);
 
-	for(auto artWin : GH.windows().findInts<CArtifactHolder>())
+	for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
 		artWin->artifactAssembled(al);
 }
 
@@ -1850,7 +1850,7 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
 	adventureInt->onHeroChanged(hero);
 
-	for(auto artWin : GH.windows().findInts<CArtifactHolder>())
+	for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
 		artWin->artifactDisassembled(al);
 }
 

+ 1 - 1
client/CServerHandler.cpp

@@ -750,7 +750,7 @@ void CServerHandler::debugStartTest(std::string filename, bool save)
 
 	boost::this_thread::sleep(boost::posix_time::milliseconds(100));
 
-	while(!settings["session"]["headless"].Bool() && !dynamic_cast<CLobbyScreen *>(GH.windows().topInt().get()))
+	while(!settings["session"]["headless"].Bool() && !dynamic_cast<CLobbyScreen *>(GH.windows().topWindow().get()))
 		boost::this_thread::sleep(boost::posix_time::milliseconds(50));
 	while(!mi || mapInfo->fileURI != CSH->mi->fileURI)
 	{

+ 2 - 2
client/Client.cpp

@@ -767,8 +767,8 @@ void CClient::removeGUI()
 {
 	// CClient::endGame
 	GH.curInt = nullptr;
-	if(GH.windows().topInt())
-		GH.windows().topInt()->deactivate();
+	if(GH.windows().topWindow())
+		GH.windows().topWindow()->deactivate();
 	adventureInt.reset();
 	GH.windows().clear();
 	GH.statusbar.reset();

+ 1 - 1
client/ClientCommandManager.cpp

@@ -196,7 +196,7 @@ void ClientCommandManager::handleNotDialogCommand()
 
 void ClientCommandManager::handleGuiCommand()
 {
-	for(const auto & child : GH.windows().findInts<CIntObject>())
+	for(const auto & child : GH.windows().findWindows<CIntObject>())
 		printInfoAboutInterfaceObject(child.get(), 0);
 }
 

+ 4 - 4
client/NetPacksLobbyClient.cpp

@@ -39,7 +39,7 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientCon
 	{
 		handler.c->connectionID = pack.clientId;
 		if(!settings["session"]["headless"].Bool())
-			GH.windows().pushIntT<CLobbyScreen>(static_cast<ESelectionScreen>(handler.screenType));
+			GH.windows().createAndPushWindow<CLobbyScreen>(static_cast<ESelectionScreen>(handler.screenType));
 		handler.state = EClientState::LOBBY;
 	}
 }
@@ -58,7 +58,7 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientDisconnected(LobbyClient
 void ApplyOnLobbyScreenNetPackVisitor::visitLobbyClientDisconnected(LobbyClientDisconnected & pack)
 {
 	if(GH.windows().count() > 0)
-		GH.windows().popInts(1);
+		GH.windows().popWindows(1);
 }
 
 void ApplyOnLobbyScreenNetPackVisitor::visitLobbyChatMessage(LobbyChatMessage & pack)
@@ -129,7 +129,7 @@ void ApplyOnLobbyScreenNetPackVisitor::visitLobbyStartGame(LobbyStartGame & pack
 	if(pack.clientId != -1 && pack.clientId != handler.c->connectionID)
 		return;
 	
-	GH.windows().pushIntT<CLoadingScreen>(std::bind(&CServerHandler::startGameplay, &handler, pack.initializedGameState));
+	GH.windows().createAndPushWindow<CLoadingScreen>(std::bind(&CServerHandler::startGameplay, &handler, pack.initializedGameState));
 }
 
 void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyUpdateState(LobbyUpdateState & pack)
@@ -146,7 +146,7 @@ void ApplyOnLobbyScreenNetPackVisitor::visitLobbyUpdateState(LobbyUpdateState &
 	if(!lobby->bonusSel && handler.si->campState && handler.state == EClientState::LOBBY_CAMPAIGN)
 	{
 		lobby->bonusSel = std::make_shared<CBonusSelection>();
-		GH.windows().pushInt(lobby->bonusSel);
+		GH.windows().pushWindow(lobby->bonusSel);
 	}
 
 	if(lobby->bonusSel)

+ 1 - 1
client/adventureMap/AdventureMapInterface.cpp

@@ -396,7 +396,7 @@ void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
 
 	if(settings["session"]["autoSkip"].Bool() && !GH.isKeyboardShiftDown())
 	{
-		if(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.windows().topInt().get()))
+		if(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.windows().topWindow().get()))
 			iw->close();
 
 		hotkeyEndingTurn();

+ 6 - 6
client/adventureMap/AdventureMapShortcuts.cpp

@@ -97,7 +97,7 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
 
 void AdventureMapShortcuts::showOverview()
 {
-	GH.windows().pushIntT<CKingdomInterface>();
+	GH.windows().createAndPushWindow<CKingdomInterface>();
 }
 
 void AdventureMapShortcuts::worldViewBack()
@@ -187,17 +187,17 @@ void AdventureMapShortcuts::showSpellbook()
 
 	owner.centerOnObject(LOCPLINT->localState->getCurrentHero());
 
-	GH.windows().pushIntT<CSpellWindow>(LOCPLINT->localState->getCurrentHero(), LOCPLINT, false);
+	GH.windows().createAndPushWindow<CSpellWindow>(LOCPLINT->localState->getCurrentHero(), LOCPLINT, false);
 }
 
 void AdventureMapShortcuts::adventureOptions()
 {
-	GH.windows().pushIntT<AdventureOptions>();
+	GH.windows().createAndPushWindow<AdventureOptions>();
 }
 
 void AdventureMapShortcuts::systemOptions()
 {
-	GH.windows().pushIntT<SettingsMainWindow>();
+	GH.windows().createAndPushWindow<SettingsMainWindow>();
 }
 
 void AdventureMapShortcuts::nextHero()
@@ -267,7 +267,7 @@ void AdventureMapShortcuts::showScenarioInfo()
 
 void AdventureMapShortcuts::saveGame()
 {
-	GH.windows().pushIntT<CSavingScreen>();
+	GH.windows().createAndPushWindow<CSavingScreen>();
 }
 
 void AdventureMapShortcuts::loadGame()
@@ -327,7 +327,7 @@ void AdventureMapShortcuts::showMarketplace()
 	}
 
 	if(townWithMarket) //if any town has marketplace, open window
-		GH.windows().pushIntT<CMarketplaceWindow>(townWithMarket);
+		GH.windows().createAndPushWindow<CMarketplaceWindow>(townWithMarket);
 	else //if not - complain
 		LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithMarket"));
 }

+ 2 - 2
client/adventureMap/AdventureOptions.cpp

@@ -51,11 +51,11 @@ void AdventureOptions::showScenarioInfo()
 {
 	if(LOCPLINT->cb->getStartInfo()->campState)
 	{
-		GH.windows().pushIntT<CCampaignInfoScreen>();
+		GH.windows().createAndPushWindow<CCampaignInfoScreen>();
 	}
 	else
 	{
-		GH.windows().pushIntT<CScenarioInfoScreen>();
+		GH.windows().createAndPushWindow<CScenarioInfoScreen>();
 	}
 }
 

+ 1 - 1
client/adventureMap/CInfoBar.cpp

@@ -262,7 +262,7 @@ void CInfoBar::tick(uint32_t msPassed)
 	{
 		timerCounter = 0;
 		removeUsedEvents(TIME);
-		if(GH.windows().topInt() == adventureInt)
+		if(GH.windows().topWindow() == adventureInt)
 			popComponents(true);
 	}
 	else

+ 2 - 2
client/battle/BattleActionsController.cpp

@@ -669,7 +669,7 @@ void BattleActionsController::actionRealize(PossiblePlayerBattleAction action, B
 
 		case PossiblePlayerBattleAction::CREATURE_INFO:
 		{
-			GH.windows().pushIntT<CStackWindow>(targetStack, false);
+			GH.windows().createAndPushWindow<CStackWindow>(targetStack, false);
 			return;
 		}
 
@@ -974,7 +974,7 @@ void BattleActionsController::onHexRightClicked(BattleHex clickedHex)
 	auto selectedStack = owner.curInt->cb->battleGetStackByPos(clickedHex, true);
 
 	if (selectedStack != nullptr)
-		GH.windows().pushIntT<CStackWindow>(selectedStack, true);
+		GH.windows().createAndPushWindow<CStackWindow>(selectedStack, true);
 
 	if (clickedHex == BattleHex::HERO_ATTACKER && owner.attackingHero)
 		owner.attackingHero->heroRightClicked();

+ 2 - 2
client/battle/BattleInterface.cpp

@@ -96,7 +96,7 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
 	adventureInt->onAudioPaused();
 	ongoingAnimationsState.set(true);
 
-	GH.windows().pushInt(windowObject);
+	GH.windows().pushWindow(windowObject);
 	windowObject->blockUI(true);
 	windowObject->updateQueue();
 
@@ -329,7 +329,7 @@ void BattleInterface::battleFinished(const BattleResult& br, QueryID queryID)
 	{
 		curInt->cb->selectionMade(selection, queryID);
 	};
-	GH.windows().pushInt(wnd);
+	GH.windows().pushWindow(wnd);
 	
 	curInt->waitWhileDialog(); // Avoid freeze when AI end turn after battle. Check bug #1897
 	CPlayerInterface::battleInt = nullptr;

+ 4 - 4
client/battle/BattleInterfaceClasses.cpp

@@ -290,7 +290,7 @@ void BattleHero::heroLeftClicked()
 	if(owner.getCurrentPlayerInterface()->cb->battleCanCastSpell(hero, spells::Mode::HERO) == ESpellCastProblem::OK) //check conditions
 	{
 		CCS->curh->set(Cursor::Map::POINTER);
-		GH.windows().pushIntT<CSpellWindow>(hero, owner.getCurrentPlayerInterface());
+		GH.windows().createAndPushWindow<CSpellWindow>(hero, owner.getCurrentPlayerInterface());
 	}
 }
 
@@ -305,7 +305,7 @@ void BattleHero::heroRightClicked()
 	{
 		auto h = defender ? owner.defendingHeroInstance : owner.attackingHeroInstance;
 		targetHero.initFromHero(h, InfoAboutHero::EInfoLevel::INBATTLE);
-		GH.windows().pushIntT<HeroInfoWindow>(targetHero, &windowPosition);
+		GH.windows().createAndPushWindow<HeroInfoWindow>(targetHero, &windowPosition);
 	}
 }
 
@@ -592,8 +592,8 @@ void BattleResultWindow::buttonPressed(int button)
 
 	close();
 
-	if(dynamic_cast<BattleWindow*>(GH.windows().topInt().get()))
-		GH.windows().popInts(1); //pop battle interface if present
+	if(dynamic_cast<BattleWindow*>(GH.windows().topWindow().get()))
+		GH.windows().popWindows(1); //pop battle interface if present
 
 	//Result window and battle interface are gone. We requested all dialogs to be closed before opening the battle,
 	//so we can be sure that there is no dialogs left on GUI stack.

+ 4 - 4
client/battle/BattleWindow.cpp

@@ -257,7 +257,7 @@ void BattleWindow::bOptionsf()
 
 	CCS->curh->set(Cursor::Map::POINTER);
 
-	GH.windows().pushIntT<SettingsMainWindow>(&owner);
+	GH.windows().createAndPushWindow<SettingsMainWindow>(&owner);
 }
 
 void BattleWindow::bSurrenderf()
@@ -425,7 +425,7 @@ void BattleWindow::bSpellf()
 
 	if(spellCastProblem == ESpellCastProblem::OK)
 	{
-		GH.windows().pushIntT<CSpellWindow>(myHero, owner.curInt.get());
+		GH.windows().createAndPushWindow<CSpellWindow>(myHero, owner.curInt.get());
 	}
 	else if (spellCastProblem == ESpellCastProblem::MAGIC_IS_BLOCKED)
 	{
@@ -570,7 +570,7 @@ void BattleWindow::show(SDL_Surface *to)
 
 void BattleWindow::close()
 {
-	if(GH.windows().topInt().get() != this)
+	if(GH.windows().topWindow().get() != this)
 		logGlobal->error("Only top interface must be closed");
-	GH.windows().popInts(1);
+	GH.windows().popWindows(1);
 }

+ 2 - 2
client/gui/CIntObject.cpp

@@ -357,9 +357,9 @@ WindowBase::WindowBase(int used_, Point pos_)
 
 void WindowBase::close()
 {
-	if(GH.windows().topInt().get() != this)
+	if(GH.windows().topWindow().get() != this)
 		logGlobal->error("Only top interface must be closed");
-	GH.windows().popInts(1);
+	GH.windows().popWindows(1);
 }
 
 IStatusBar::~IStatusBar()

+ 4 - 4
client/gui/WindowHandler.cpp

@@ -19,7 +19,7 @@
 #include "../render/Colors.h"
 #include "../renderSDL/SDL_Extensions.h"
 
-void WindowHandler::popInt(std::shared_ptr<IShowActivatable> top)
+void WindowHandler::popWindow(std::shared_ptr<IShowActivatable> top)
 {
 	assert(windowsStack.back() == top);
 	top->deactivate();
@@ -31,7 +31,7 @@ void WindowHandler::popInt(std::shared_ptr<IShowActivatable> top)
 	totalRedraw();
 }
 
-void WindowHandler::pushInt(std::shared_ptr<IShowActivatable> newInt)
+void WindowHandler::pushWindow(std::shared_ptr<IShowActivatable> newInt)
 {
 	assert(newInt);
 	assert(!vstd::contains(windowsStack, newInt)); // do not add same object twice
@@ -47,7 +47,7 @@ void WindowHandler::pushInt(std::shared_ptr<IShowActivatable> newInt)
 	totalRedraw();
 }
 
-void WindowHandler::popInts(int howMany)
+void WindowHandler::popWindows(int howMany)
 {
 	if(!howMany)
 		return; //senseless but who knows...
@@ -68,7 +68,7 @@ void WindowHandler::popInts(int howMany)
 	GH.fakeMouseMove();
 }
 
-std::shared_ptr<IShowActivatable> WindowHandler::topInt() const
+std::shared_ptr<IShowActivatable> WindowHandler::topWindow() const
 {
 	if(windowsStack.empty())
 		return nullptr;

+ 18 - 19
client/gui/WindowHandler.h

@@ -13,8 +13,8 @@ class IShowActivatable;
 
 class WindowHandler
 {
-	/// list of interfaces. front = bottom-most (background), back = top-most (foreground)
-	/// (includes adventure map, window interfaces, all kind of active dialogs, and so on)
+	/// list of windows. front = bottom-most (background), back = top-most (foreground)
+	/// (includes adventure map, window windows, all kind of active dialogs, and so on)
 	std::vector<std::shared_ptr<IShowActivatable>> windowsStack;
 
 	/// Temporary list of recently popped windows
@@ -24,27 +24,27 @@ public:
 	/// forces total redraw (using showAll), sets a flag, method gets called at the end of the rendering
 	void totalRedraw();
 
-	/// update only top interface and draw background from buffer, sets a flag, method gets called at the end of the rendering
+	/// update only top windows and draw background from buffer, sets a flag, method gets called at the end of the rendering
 	void simpleRedraw();
 
 	/// called whenever user selects different resolution, requiring to center/resize all windows
 	void onScreenResize();
 
-	/// deactivate old top interface, activates this one and pushes to the top
-	void pushInt(std::shared_ptr<IShowActivatable> newInt);
+	/// deactivate old top windows, activates this one and pushes to the top
+	void pushWindow(std::shared_ptr<IShowActivatable> newInt);
 
 	/// creates window of class T and pushes it to the top
 	template <typename T, typename ... Args>
-	void pushIntT(Args && ... args);
+	void createAndPushWindow(Args && ... args);
 
-	/// pops one or more interfaces - deactivates top, deletes and removes given number of interfaces, activates new front
-	void popInts(int howMany);
+	/// pops one or more windows - deactivates top, deletes and removes given number of windows, activates new front
+	void popWindows(int howMany);
 
-	/// removes given interface from the top and activates next
-	void popInt(std::shared_ptr<IShowActivatable> top);
+	/// removes given windows from the top and activates next
+	void popWindow(std::shared_ptr<IShowActivatable> top);
 
-	/// returns top interface
-	std::shared_ptr<IShowActivatable> topInt() const;
+	/// returns top windows
+	std::shared_ptr<IShowActivatable> topWindow() const;
 
 	/// should be called after frame has been rendered to screen
 	void onFrameRendered();
@@ -52,23 +52,23 @@ public:
 	/// returns current number of windows in the stack
 	size_t count() const;
 
-	/// erases all currently existing windows from the stacl
+	/// erases all currently existing windows from the stack
 	void clear();
 
 	/// returns all existing windows of selected type
 	template <typename T>
-	std::vector<std::shared_ptr<T>> findInts() const;
+	std::vector<std::shared_ptr<T>> findWindows() const;
 };
 
 template <typename T, typename ... Args>
-void WindowHandler::pushIntT(Args && ... args)
+void WindowHandler::createAndPushWindow(Args && ... args)
 {
-	auto newInt = std::make_shared<T>(std::forward<Args>(args)...);
-	pushInt(newInt);
+	auto newWindow = std::make_shared<T>(std::forward<Args>(args)...);
+	pushWindow(newWindow);
 }
 
 template <typename T>
-std::vector<std::shared_ptr<T>> WindowHandler::findInts() const
+std::vector<std::shared_ptr<T>> WindowHandler::findWindows() const
 {
 	std::vector<std::shared_ptr<T>> result;
 
@@ -79,6 +79,5 @@ std::vector<std::shared_ptr<T>> WindowHandler::findInts() const
 		if (casted)
 			result.push_back(casted);
 	}
-
 	return result;
 }

+ 2 - 2
client/lobby/CBonusSelection.cpp

@@ -368,7 +368,7 @@ void CBonusSelection::goBack()
 {
 	if(CSH->state != EClientState::GAMEPLAY)
 	{
-		GH.windows().popInts(2);
+		GH.windows().popWindows(2);
 	}
 	else
 	{
@@ -398,7 +398,7 @@ void CBonusSelection::startMap()
 		const CCampaignScenario & scenario = getCampaign()->camp->scenarios[CSH->campaignMap];
 		if(scenario.prolog.hasPrologEpilog)
 		{
-			GH.windows().pushIntT<CPrologEpilogVideo>(scenario.prolog, exitCb);
+			GH.windows().createAndPushWindow<CPrologEpilogVideo>(scenario.prolog, exitCb);
 		}
 		else
 		{

+ 1 - 1
client/lobby/CSelectionBase.cpp

@@ -379,7 +379,7 @@ void CFlagBox::recreate()
 void CFlagBox::clickRight(tribool down, bool previousState)
 {
 	if(down && SEL->getMapInfo())
-		GH.windows().pushIntT<CFlagBoxTooltipBox>(iconsTeamFlags);
+		GH.windows().createAndPushWindow<CFlagBoxTooltipBox>(iconsTeamFlags);
 }
 
 CFlagBox::CFlagBoxTooltipBox::CFlagBoxTooltipBox(std::shared_ptr<CAnimation> icons)

+ 1 - 1
client/lobby/OptionsTab.cpp

@@ -436,7 +436,7 @@ void OptionsTab::SelectedBox::clickRight(tribool down, bool previousState)
 		if(settings.hero == -2 && !SEL->getPlayerInfo(settings.color.getNum()).hasCustomMainHero() && CPlayerSettingsHelper::type == HERO)
 			return;
 
-		GH.windows().pushIntT<CPlayerOptionTooltipBox>(*this);
+		GH.windows().createAndPushWindow<CPlayerOptionTooltipBox>(*this);
 	}
 }
 

+ 10 - 10
client/lobby/RandomMapTab.cpp

@@ -103,12 +103,12 @@ RandomMapTab::RandomMapTab():
 	//new callbacks available only from mod
 	addCallback("templateSelection", [&](int)
 	{
-		GH.windows().pushIntT<TemplatesDropBox>(*this, int3{mapGenOptions->getWidth(), mapGenOptions->getHeight(), 1 + mapGenOptions->getHasTwoLevels()});
+		GH.windows().createAndPushWindow<TemplatesDropBox>(*this, int3{mapGenOptions->getWidth(), mapGenOptions->getHeight(), 1 + mapGenOptions->getHasTwoLevels()});
 	});
 	
 	addCallback("teamAlignments", [&](int)
 	{
-		GH.windows().pushIntT<TeamAlignmentsWidget>(*this);
+		GH.windows().createAndPushWindow<TeamAlignmentsWidget>(*this);
 	});
 	
 	for(auto road : VLC->roadTypeHandler->objects)
@@ -483,8 +483,8 @@ void TemplatesDropBox::clickLeft(tribool down, bool previousState)
 		// pop the interface only if the mouse is not clicking on the slider
 		if (!w || !w->mouseState(MouseButton::LEFT))
 		{
-			assert(GH.windows().topInt().get() == this);
-			GH.windows().popInt(GH.windows().topInt());
+			assert(GH.windows().topWindow().get() == this);
+			GH.windows().popWindow(GH.windows().topWindow());
 		}
 	}
 }
@@ -512,8 +512,8 @@ void TemplatesDropBox::updateListItems()
 void TemplatesDropBox::setTemplate(const CRmgTemplate * tmpl)
 {
 	randomMapTab.setTemplate(tmpl);
-	assert(GH.windows().topInt().get() == this);
-	GH.windows().popInt(GH.windows().topInt());
+	assert(GH.windows().topWindow().get() == this);
+	GH.windows().popWindow(GH.windows().topWindow());
 }
 
 TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
@@ -548,14 +548,14 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
 			randomMapTab.obtainMapGenOptions().setPlayerTeam(PlayerColor(plId), TeamID(players[plId]->getSelected()));
 		}
 		randomMapTab.updateMapInfoByHost();
-		assert(GH.windows().topInt().get() == this);
-		GH.windows().popInt(GH.windows().topInt());
+		assert(GH.windows().topWindow().get() == this);
+		GH.windows().popWindow(GH.windows().topWindow());
 	});
 	
 	addCallback("cancel", [&](int)
 	{
-		assert(GH.windows().topInt().get() == this);
-		GH.windows().popInt(GH.windows().topInt());
+		assert(GH.windows().topWindow().get() == this);
+		GH.windows().popWindow(GH.windows().topWindow());
 	});
 	
 	build(config);

+ 13 - 13
client/mainmenu/CMainMenu.cpp

@@ -178,7 +178,7 @@ static std::function<void()> genCommand(CMenuScreen * menu, std::vector<std::str
 				case 0:
 					return std::bind(CMainMenu::openLobby, ESelectionScreen::newGame, true, nullptr, ELoadMode::NONE);
 				case 1:
-					return []() { GH.windows().pushIntT<CMultiMode>(ESelectionScreen::newGame); };
+					return []() { GH.windows().createAndPushWindow<CMultiMode>(ESelectionScreen::newGame); };
 				case 2:
 					return std::bind(CMainMenu::openLobby, ESelectionScreen::campaignList, true, nullptr, ELoadMode::NONE);
 				case 3:
@@ -193,7 +193,7 @@ static std::function<void()> genCommand(CMenuScreen * menu, std::vector<std::str
 				case 0:
 					return std::bind(CMainMenu::openLobby, ESelectionScreen::loadGame, true, nullptr, ELoadMode::SINGLE);
 				case 1:
-					return []() { GH.windows().pushIntT<CMultiMode>(ESelectionScreen::loadGame); };
+					return []() { GH.windows().createAndPushWindow<CMultiMode>(ESelectionScreen::loadGame); };
 				case 2:
 					return std::bind(CMainMenu::openLobby, ESelectionScreen::loadGame, true, nullptr, ELoadMode::CAMPAIGN);
 				case 3:
@@ -327,8 +327,8 @@ void CMainMenu::update()
 
 	if(GH.windows().count() == 0)
 	{
-		GH.windows().pushInt(CMM);
-		GH.windows().pushInt(menu);
+		GH.windows().pushWindow(CMM);
+		GH.windows().pushWindow(menu);
 		menu->switchToTab(menu->getActiveTab());
 	}
 
@@ -338,8 +338,8 @@ void CMainMenu::update()
 
 	// check for null othervice crash on finishing a campaign
 	// /FIXME: find out why GH.windows().listInt is empty to begin with
-	if(GH.windows().topInt())
-		GH.windows().topInt()->show(screen);
+	if(GH.windows().topWindow())
+		GH.windows().topWindow()->show(screen);
 }
 
 void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vector<std::string> * names, ELoadMode loadMode)
@@ -348,7 +348,7 @@ void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vec
 	CSH->screenType = screenType;
 	CSH->loadMode = loadMode;
 
-	GH.windows().pushIntT<CSimpleJoinScreen>(host);
+	GH.windows().createAndPushWindow<CSimpleJoinScreen>(host);
 }
 
 void CMainMenu::openCampaignLobby(const std::string & campaignFileName)
@@ -362,14 +362,14 @@ void CMainMenu::openCampaignLobby(std::shared_ptr<CCampaignState> campaign)
 	CSH->resetStateForLobby(StartInfo::CAMPAIGN);
 	CSH->screenType = ESelectionScreen::campaignList;
 	CSH->campaignStateToSend = campaign;
-	GH.windows().pushIntT<CSimpleJoinScreen>();
+	GH.windows().createAndPushWindow<CSimpleJoinScreen>();
 }
 
 void CMainMenu::openCampaignScreen(std::string name)
 {
 	if(vstd::contains(CMainMenuConfig::get().getCampaigns().Struct(), name))
 	{
-		GH.windows().pushIntT<CCampaignScreen>(CMainMenuConfig::get().getCampaigns()[name]);
+		GH.windows().createAndPushWindow<CCampaignScreen>(CMainMenuConfig::get().getCampaigns()[name]);
 		return;
 	}
 	logGlobal->error("Unknown campaign set: %s", name);
@@ -414,14 +414,14 @@ void CMultiMode::hostTCP()
 {
 	auto savedScreenType = screenType;
 	close();
-	GH.windows().pushIntT<CMultiPlayers>(settings["general"]["playerName"].String(), savedScreenType, true, ELoadMode::MULTI);
+	GH.windows().createAndPushWindow<CMultiPlayers>(settings["general"]["playerName"].String(), savedScreenType, true, ELoadMode::MULTI);
 }
 
 void CMultiMode::joinTCP()
 {
 	auto savedScreenType = screenType;
 	close();
-	GH.windows().pushIntT<CMultiPlayers>(settings["general"]["playerName"].String(), savedScreenType, false, ELoadMode::MULTI);
+	GH.windows().createAndPushWindow<CMultiPlayers>(settings["general"]["playerName"].String(), savedScreenType, false, ELoadMode::MULTI);
 }
 
 void CMultiMode::onNameChange(std::string newText)
@@ -523,7 +523,7 @@ void CSimpleJoinScreen::leaveScreen()
 		textTitle->setText("Closing...");
 		CSH->state = EClientState::CONNECTION_CANCELLED;
 	}
-	else if(GH.windows().topInt().get() == this)
+	else if(GH.windows().topWindow().get() == this)
 	{
 		close();
 	}
@@ -553,7 +553,7 @@ void CSimpleJoinScreen::connectThread(const std::string & addr, ui16 port)
 	else
 		CSH->justConnectToServer(addr, port);
 
-	if(GH.windows().topInt().get() == this)
+	if(GH.windows().topWindow().get() == this)
 	{
 		close();
 	}

+ 2 - 2
client/mapView/MapViewController.cpp

@@ -209,7 +209,7 @@ bool MapViewController::isEventVisible(const CGObjectInstance * obj)
 	if(!LOCPLINT->makingTurn && settings["adventure"]["enemyMoveTime"].Float() < 0)
 		return false; // enemy move speed set to "hidden/none"
 
-	if(GH.windows().topInt() != adventureInt)
+	if(GH.windows().topWindow() != adventureInt)
 		return false;
 
 	if(obj->isVisitable())
@@ -226,7 +226,7 @@ bool MapViewController::isEventVisible(const CGHeroInstance * obj, const int3 &
 	if(!LOCPLINT->makingTurn && settings["adventure"]["enemyMoveTime"].Float() < 0)
 		return false; // enemy move speed set to "hidden/none"
 
-	if(GH.windows().topInt() != adventureInt)
+	if(GH.windows().topWindow() != adventureInt)
 		return false;
 
 	if(context->isVisible(obj->convertToVisitablePos(from)))

+ 4 - 4
client/widgets/CGarrisonInt.cpp

@@ -175,7 +175,7 @@ bool CGarrisonSlot::viewInfo()
 		elem->block(true);
 
 	redraw();
-	GH.windows().pushIntT<CStackWindow>(myStack, dism, pom, upgr);
+	GH.windows().createAndPushWindow<CStackWindow>(myStack, dism, pom, upgr);
 	return true;
 }
 
@@ -184,7 +184,7 @@ bool CGarrisonSlot::viewInfo()
 bool CGarrisonSlot::highlightOrDropArtifact()
 {
 	bool artSelected = false;
-	if (CWindowWithArtifacts* chw = dynamic_cast<CWindowWithArtifacts*>(GH.windows().topInt().get())) //dirty solution
+	if (CWindowWithArtifacts* chw = dynamic_cast<CWindowWithArtifacts*>(GH.windows().topWindow().get())) //dirty solution
 	{
 		const auto pickedArtInst = chw->getPickedArtifact();
 
@@ -253,7 +253,7 @@ bool CGarrisonSlot::split()
 	int countLeft = selection->myStack ? selection->myStack->count : 0;
 	int countRight = myStack ? myStack->count : 0;
 
-	GH.windows().pushIntT<CSplitWindow>(selection->creature, std::bind(&CGarrisonInt::splitStacks, owner, _1, _2),
+	GH.windows().createAndPushWindow<CSplitWindow>(selection->creature, std::bind(&CGarrisonInt::splitStacks, owner, _1, _2),
 		minLeft, minRight, countLeft, countRight);
 	return true;
 }
@@ -290,7 +290,7 @@ void CGarrisonSlot::clickRight(tribool down, bool previousState)
 {
 	if(creature && down)
 	{
-		GH.windows().pushIntT<CStackWindow>(myStack, true);
+		GH.windows().createAndPushWindow<CStackWindow>(myStack, true);
 	}
 }
 

+ 1 - 1
client/widgets/CWindowWithArtifacts.cpp

@@ -66,7 +66,7 @@ void CWindowWithArtifacts::leftClickArtPlaceHero(CArtifactsOfHeroBase & artsInst
 	{
 		if(artPlace.getArt()->getTypeId() == ArtifactID::SPELLBOOK)
 		{
-			GH.windows().pushIntT<CSpellWindow>(hero, LOCPLINT, LOCPLINT->battleInt.get());
+			GH.windows().createAndPushWindow<CSpellWindow>(hero, LOCPLINT, LOCPLINT->battleInt.get());
 			return false;
 		}
 		if(artPlace.getArt()->getTypeId() == ArtifactID::CATAPULT)

+ 21 - 21
client/windows/CCastleInterface.cpp

@@ -159,7 +159,7 @@ void CBuildingRect::clickRight(tribool down, bool previousState)
 		else
 		{
 			int level = ( bid - BuildingID::DWELL_FIRST ) % GameConstants::CREATURES_PER_TOWN;
-			GH.windows().pushIntT<CDwellingInfoBox>(parent->pos.x+parent->pos.w / 2, parent->pos.y+parent->pos.h  /2, town, level);
+			GH.windows().createAndPushWindow<CDwellingInfoBox>(parent->pos.x+parent->pos.w / 2, parent->pos.y+parent->pos.h  /2, town, level);
 		}
 	}
 }
@@ -421,7 +421,7 @@ void CHeroGSlot::clickRight(tribool down, bool previousState)
 {
 	if(hero && down)
 	{
-		GH.windows().pushIntT<CInfoBoxPopup>(Point(pos.x + 175, pos.y + 100), hero);
+		GH.windows().createAndPushWindow<CInfoBoxPopup>(Point(pos.x + 175, pos.y + 100), hero);
 	}
 }
 
@@ -697,7 +697,7 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
 		case BuildingID::FORT:
 		case BuildingID::CITADEL:
 		case BuildingID::CASTLE:
-				GH.windows().pushIntT<CFortScreen>(town);
+				GH.windows().createAndPushWindow<CFortScreen>(town);
 				break;
 
 		case BuildingID::VILLAGE_HALL:
@@ -708,7 +708,7 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
 				break;
 
 		case BuildingID::MARKETPLACE:
-				GH.windows().pushIntT<CMarketplaceWindow>(town, town->visitingHero);
+				GH.windows().createAndPushWindow<CMarketplaceWindow>(town, town->visitingHero);
 				break;
 
 		case BuildingID::BLACKSMITH:
@@ -734,7 +734,7 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
 
 				case BuildingSubID::ARTIFACT_MERCHANT:
 						if(town->visitingHero)
-							GH.windows().pushIntT<CMarketplaceWindow>(town, town->visitingHero, EMarketMode::RESOURCE_ARTIFACT);
+							GH.windows().createAndPushWindow<CMarketplaceWindow>(town, town->visitingHero, EMarketMode::RESOURCE_ARTIFACT);
 						else
 							LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % b->getNameTranslated())); //Only visiting heroes may use the %s.
 						break;
@@ -745,14 +745,14 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
 
 				case BuildingSubID::FREELANCERS_GUILD:
 						if(getHero())
-							GH.windows().pushIntT<CMarketplaceWindow>(town, getHero(), EMarketMode::CREATURE_RESOURCE);
+							GH.windows().createAndPushWindow<CMarketplaceWindow>(town, getHero(), EMarketMode::CREATURE_RESOURCE);
 						else
 							LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % b->getNameTranslated())); //Only visiting heroes may use the %s.
 						break;
 
 				case BuildingSubID::MAGIC_UNIVERSITY:
 						if (getHero())
-							GH.windows().pushIntT<CUniversityWindow>(getHero(), town);
+							GH.windows().createAndPushWindow<CUniversityWindow>(getHero(), town);
 						else
 							enterBuilding(building);
 						break;
@@ -769,7 +769,7 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
 						break;
 
 				case BuildingSubID::CREATURE_TRANSFORMER: //Skeleton Transformer
-						GH.windows().pushIntT<CTransformerWindow>(town, getHero());
+						GH.windows().createAndPushWindow<CTransformerWindow>(town, getHero());
 						break;
 
 				case BuildingSubID::PORTAL_OF_SUMMONING:
@@ -824,7 +824,7 @@ void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
 		}
 	}
 	CreatureID cre = art->getWarMachine();
-	GH.windows().pushIntT<CBlacksmithDialog>(possible, cre, artifactID, hero->id);
+	GH.windows().createAndPushWindow<CBlacksmithDialog>(possible, cre, artifactID, hero->id);
 }
 
 void CCastleBuildings::enterBuilding(BuildingID building)
@@ -853,7 +853,7 @@ void CCastleBuildings::enterCastleGate()
 		}
 	}
 	auto gateIcon = std::make_shared<CAnimImage>(town->town->clientInfo.buildingsIcons, BuildingID::CASTLE_GATE);//will be deleted by selection window
-	GH.windows().pushIntT<CObjectListWindow>(availableTowns, gateIcon, CGI->generaltexth->jktexts[40],
+	GH.windows().createAndPushWindow<CObjectListWindow>(availableTowns, gateIcon, CGI->generaltexth->jktexts[40],
 		CGI->generaltexth->jktexts[41], std::bind (&CCastleInterface::castleTeleport, LOCPLINT->castleInt, _1));
 }
 
@@ -864,7 +864,7 @@ void CCastleBuildings::enterDwelling(int level)
 	{
 		LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
 	};
-	GH.windows().pushIntT<CRecruitmentWindow>(town, level, town, recruitCb, -87);
+	GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, -87);
 }
 
 void CCastleBuildings::enterToTheQuickRecruitmentWindow()
@@ -876,7 +876,7 @@ void CCastleBuildings::enterToTheQuickRecruitmentWindow()
 	const auto hasSomeoneToRecruit = std::any_of(beginIt, afterLastIt,
 		[](const auto & creatureInfo) { return creatureInfo.first > 0; });
 	if(hasSomeoneToRecruit)
-		GH.windows().pushIntT<QuickRecruitmentWindow>(town, pos);
+		GH.windows().createAndPushWindow<QuickRecruitmentWindow>(town, pos);
 	else
 		CInfoWindow::showInfoDialog(CGI->generaltexth->translate("vcmi.townHall.noCreaturesToRecruit"), {});
 }
@@ -974,7 +974,7 @@ void CCastleBuildings::enterTownHall()
 		else
 		{
 			LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[673]);
-			dynamic_cast<CInfoWindow*>(GH.windows().topInt().get())->buttons[0]->addCallback(std::bind(&CCastleBuildings::openTownHall, this));
+			dynamic_cast<CInfoWindow*>(GH.windows().topWindow().get())->buttons[0]->addCallback(std::bind(&CCastleBuildings::openTownHall, this));
 		}
 	}
 	else
@@ -987,12 +987,12 @@ void CCastleBuildings::openMagesGuild()
 {
 	std::string mageGuildBackground;
 	mageGuildBackground = LOCPLINT->castleInt->town->town->clientInfo.guildBackground;
-	GH.windows().pushIntT<CMageGuildScreen>(LOCPLINT->castleInt,mageGuildBackground);
+	GH.windows().createAndPushWindow<CMageGuildScreen>(LOCPLINT->castleInt,mageGuildBackground);
 }
 
 void CCastleBuildings::openTownHall()
 {
-	GH.windows().pushIntT<CHallInterface>(town);
+	GH.windows().createAndPushWindow<CHallInterface>(town);
 }
 
 CCreaInfo::CCreaInfo(Point position, const CGTownInstance * Town, int Level, bool compact, bool _showAvailable):
@@ -1075,7 +1075,7 @@ void CCreaInfo::clickLeft(tribool down, bool previousState)
 		{
 			LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
 		};
-		GH.windows().pushIntT<CRecruitmentWindow>(town, level, town, recruitCb, offset);
+		GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, offset);
 	}
 }
 
@@ -1095,7 +1095,7 @@ void CCreaInfo::clickRight(tribool down, bool previousState)
 	if(down)
 	{
 		if (showAvailable)
-			GH.windows().pushIntT<CDwellingInfoBox>(GH.screenDimensions().x / 2, GH.screenDimensions().y / 2, town, level);
+			GH.windows().createAndPushWindow<CDwellingInfoBox>(GH.screenDimensions().x / 2, GH.screenDimensions().y / 2, town, level);
 		else
 			CRClickPopup::createAndPush(genGrowthText(), std::make_shared<CComponent>(CComponent::creature, creature->getId()));
 	}
@@ -1254,7 +1254,7 @@ void CCastleInterface::townChange()
 	if ( dest == town )
 		return;
 	close();
-	GH.windows().pushIntT<CCastleInterface>(dest, town);
+	GH.windows().createAndPushWindow<CCastleInterface>(dest, town);
 }
 
 void CCastleInterface::addBuilding(BuildingID bid)
@@ -1394,13 +1394,13 @@ void CHallInterface::CBuildingBox::hover(bool on)
 void CHallInterface::CBuildingBox::clickLeft(tribool down, bool previousState)
 {
 	if(previousState && (!down))
-		GH.windows().pushIntT<CBuildWindow>(town,building,state,0);
+		GH.windows().createAndPushWindow<CBuildWindow>(town,building,state,0);
 }
 
 void CHallInterface::CBuildingBox::clickRight(tribool down, bool previousState)
 {
 	if(down)
-		GH.windows().pushIntT<CBuildWindow>(town,building,state,1);
+		GH.windows().createAndPushWindow<CBuildWindow>(town,building,state,1);
 }
 
 CHallInterface::CHallInterface(const CGTownInstance * Town):
@@ -1494,7 +1494,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 void CBuildWindow::buyFunc()
 {
 	LOCPLINT->cb->buildBuilding(town,building->bid);
-	GH.windows().popInts(2); //we - build window and hall screen
+	GH.windows().popWindows(2); //we - build window and hall screen
 }
 
 std::string CBuildWindow::getTextForState(int state)

+ 5 - 5
client/windows/CHeroWindow.cpp

@@ -97,8 +97,8 @@ void CHeroSwitcher::clickLeft(tribool down, bool previousState)
 		else
 		{
 			const CGHeroInstance * buf = hero;
-			GH.windows().popInts(1);
-			GH.windows().pushIntT<CHeroWindow>(buf);
+			GH.windows().popWindows(1);
+			GH.windows().createAndPushWindow<CHeroWindow>(buf);
 		}
 	}
 }
@@ -315,14 +315,14 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
 	//if we have exchange window with this curHero open
 	bool noDismiss=false;
 
-	for(auto cew : GH.windows().findInts<CExchangeWindow>())
+	for(auto cew : GH.windows().findWindows<CExchangeWindow>())
 	{
 		for(int g=0; g < cew->heroInst.size(); ++g)
 			if(cew->heroInst[g] == curHero)
 				noDismiss = true;
 	}
 
-	for(auto ki : GH.windows().findInts<CKingdomInterface>())
+	for(auto ki : GH.windows().findWindows<CKingdomInterface>())
 		noDismiss = true;
 
 	//if player only have one hero and no towns
@@ -389,7 +389,7 @@ void CHeroWindow::commanderWindow()
 	}
 	else
 	{
-		GH.windows().pushIntT<CStackWindow>(curHero->commander, false);
+		GH.windows().createAndPushWindow<CStackWindow>(curHero->commander, false);
 	}
 }
 

+ 1 - 1
client/windows/CSpellWindow.cpp

@@ -526,7 +526,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 		else //adventure spell
 		{
 			const CGHeroInstance * h = owner->myHero;
-			GH.windows().popInts(1);
+			GH.windows().popWindows(1);
 
 			auto guard = vstd::makeScopeGuard([this]()
 			{

+ 2 - 2
client/windows/CTradeWindow.cpp

@@ -629,10 +629,10 @@ void CTradeWindow::setMode(EMarketMode::EMarketMode Mode)
 	{
 	case EMarketMode::CREATURE_EXP:
 	case EMarketMode::ARTIFACT_EXP:
-		GH.windows().pushIntT<CAltarWindow>(m, h, Mode);
+		GH.windows().createAndPushWindow<CAltarWindow>(m, h, Mode);
 		break;
 	default:
-		GH.windows().pushIntT<CMarketplaceWindow>(m, h, Mode);
+		GH.windows().createAndPushWindow<CMarketplaceWindow>(m, h, Mode);
 		break;
 	}
 }

+ 1 - 1
client/windows/CreaturePurchaseCard.cpp

@@ -125,5 +125,5 @@ CreaturePurchaseCard::CCreatureClickArea::CCreatureClickArea(const Point & posit
 void CreaturePurchaseCard::CCreatureClickArea::clickRight(tribool down, bool previousState)
 {
 	if (down)
-		GH.windows().pushIntT<CStackWindow>(creatureOnTheCard, true);
+		GH.windows().createAndPushWindow<CStackWindow>(creatureOnTheCard, true);
 }

+ 4 - 4
client/windows/GUIClasses.cpp

@@ -99,7 +99,7 @@ void CRecruitmentWindow::CCreatureCard::clickLeft(tribool down, bool previousSta
 void CRecruitmentWindow::CCreatureCard::clickRight(tribool down, bool previousState)
 {
 	if(down)
-		GH.windows().pushIntT<CStackWindow>(creature, true);
+		GH.windows().createAndPushWindow<CStackWindow>(creature, true);
 }
 
 void CRecruitmentWindow::CCreatureCard::showAll(SDL_Surface * to)
@@ -508,7 +508,7 @@ void CTavernWindow::recruitb()
 
 void CTavernWindow::thievesguildb()
 {
-	GH.windows().pushIntT<CThievesGuildWindow>(tavernObj);
+	GH.windows().createAndPushWindow<CThievesGuildWindow>(tavernObj);
 }
 
 CTavernWindow::~CTavernWindow()
@@ -548,7 +548,7 @@ void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
 void CTavernWindow::HeroPortrait::clickRight(tribool down, bool previousState)
 {
 	if(h && down)
-		GH.windows().pushIntT<CRClickPopupInt>(std::make_shared<CHeroWindow>(h));
+		GH.windows().createAndPushWindow<CRClickPopupInt>(std::make_shared<CHeroWindow>(h));
 }
 
 CTavernWindow::HeroPortrait::HeroPortrait(int & sel, int id, int x, int y, const CGHeroInstance * H)
@@ -1241,7 +1241,7 @@ void CUniversityWindow::CItem::clickLeft(tribool down, bool previousState)
 	if(previousState && (!down))
 	{
 		if(state() == 2)
-			GH.windows().pushIntT<CUnivConfirmWindow>(parent, ID, LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) >= 2000);
+			GH.windows().createAndPushWindow<CUnivConfirmWindow>(parent, ID, LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) >= 2000);
 	}
 }
 

+ 4 - 4
client/windows/InfoWindows.cpp

@@ -183,7 +183,7 @@ void CInfoWindow::showAll(SDL_Surface * to)
 
 void CInfoWindow::showInfoDialog(const std::string &text, const TCompsInfo & components, PlayerColor player)
 {
-	GH.windows().pushInt(CInfoWindow::create(text, player, components));
+	GH.windows().pushWindow(CInfoWindow::create(text, player, components));
 }
 
 void CInfoWindow::showYesNoDialog(const std::string & text, const TCompsInfo & components, const CFunctionList<void( ) > &onYes, const CFunctionList<void()> &onNo, PlayerColor player)
@@ -197,7 +197,7 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const TCompsInfo & c
 	temp->buttons[0]->addCallback( onYes );
 	temp->buttons[1]->addCallback( onNo );
 
-	GH.windows().pushInt(temp);
+	GH.windows().pushWindow(temp);
 }
 
 std::shared_ptr<CInfoWindow> CInfoWindow::create(const std::string &text, PlayerColor playerID, const TCompsInfo & components)
@@ -314,7 +314,7 @@ void CRClickPopup::createAndPush(const std::string &txt, const CInfoWindow::TCom
 #endif
 	temp->fitToScreen(10);
 
-	GH.windows().pushIntT<CRClickPopupInt>(temp);
+	GH.windows().createAndPushWindow<CRClickPopupInt>(temp);
 }
 
 void CRClickPopup::createAndPush(const std::string & txt, std::shared_ptr<CComponent> component)
@@ -330,7 +330,7 @@ void CRClickPopup::createAndPush(const CGObjectInstance * obj, const Point & p,
 	auto iWin = createInfoWin(p, obj); //try get custom infowindow for this obj
 	if(iWin)
 	{
-		GH.windows().pushInt(iWin);
+		GH.windows().pushWindow(iWin);
 	}
 	else
 	{

+ 2 - 2
client/windows/settings/GeneralOptionsTab.cpp

@@ -198,7 +198,7 @@ void GeneralOptionsTab::selectGameResolution()
 		items.push_back(std::move(resolutionStr));
 		++i;
 	}
-	GH.windows().pushIntT<CObjectListWindow>(items, nullptr,
+	GH.windows().createAndPushWindow<CObjectListWindow>(items, nullptr,
 								   CGI->generaltexth->translate("vcmi.systemOptions.resolutionMenu.hover"),
 								   CGI->generaltexth->translate("vcmi.systemOptions.resolutionMenu.help"),
 								   [this](int index)
@@ -253,7 +253,7 @@ void GeneralOptionsTab::selectGameScaling()
 		++i;
 	}
 
-	GH.windows().pushIntT<CObjectListWindow>(
+	GH.windows().createAndPushWindow<CObjectListWindow>(
 		items,
 		nullptr,
 		CGI->generaltexth->translate("vcmi.systemOptions.scalingMenu.hover"),

+ 3 - 3
client/windows/settings/SettingsMainWindow.cpp

@@ -104,9 +104,9 @@ void SettingsMainWindow::openTab(size_t index)
 
 void SettingsMainWindow::close()
 {
-	if(GH.windows().topInt().get() != this)
+	if(GH.windows().topWindow().get() != this)
 		logGlobal->error("Only top interface must be closed");
-	GH.windows().popInts(1);
+	GH.windows().popWindows(1);
 }
 
 void SettingsMainWindow::quitGameButtonCallback()
@@ -133,7 +133,7 @@ void SettingsMainWindow::loadGameButtonCallback()
 void SettingsMainWindow::saveGameButtonCallback()
 {
 	close();
-	GH.windows().pushIntT<CSavingScreen>();
+	GH.windows().createAndPushWindow<CSavingScreen>();
 }
 
 void SettingsMainWindow::restartGameButtonCallback()