|
|
@@ -65,6 +65,7 @@
|
|
|
#include "../lib/CPlayerState.h"
|
|
|
#include "../lib/GameConstants.h"
|
|
|
#include "gui/CGuiHandler.h"
|
|
|
+#include "gui/WindowHandler.h"
|
|
|
#include "windows/InfoWindows.h"
|
|
|
#include "../lib/UnlockGuard.h"
|
|
|
#include "../lib/CPathfinder.h"
|
|
|
@@ -168,16 +169,17 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
|
|
|
void CPlayerInterface::playerStartsTurn(PlayerColor player)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- if (!vstd::contains (GH.listInt, adventureInt))
|
|
|
+
|
|
|
+ if(GH.windows().findWindows<AdventureMapInterface>().empty())
|
|
|
{
|
|
|
// after map load - remove all active windows and replace them with adventure map
|
|
|
- GH.popInts ((int)GH.listInt.size());
|
|
|
- GH.pushInt (adventureInt);
|
|
|
+ GH.windows().clear();
|
|
|
+ GH.windows().pushWindow(adventureInt);
|
|
|
}
|
|
|
|
|
|
// remove all dialogs that do not expect query answer
|
|
|
- while (GH.listInt.front() != adventureInt && !dynamic_cast<CInfoWindow*>(GH.listInt.front().get()))
|
|
|
- GH.popInts(1);
|
|
|
+ while (!GH.windows().topWindow<AdventureMapInterface>() && !GH.windows().topWindow<CInfoWindow>())
|
|
|
+ GH.windows().popWindows(1);
|
|
|
|
|
|
if (player != playerID && LOCPLINT == this)
|
|
|
{
|
|
|
@@ -245,7 +247,7 @@ void CPlayerInterface::acceptTurn()
|
|
|
{
|
|
|
if (settings["session"]["autoSkip"].Bool())
|
|
|
{
|
|
|
- while(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.topInt().get()))
|
|
|
+ while(auto iw = GH.windows().topWindow<CInfoWindow>())
|
|
|
iw->close();
|
|
|
}
|
|
|
|
|
|
@@ -439,7 +441,7 @@ void CPlayerInterface::openTownWindow(const CGTownInstance * town)
|
|
|
|
|
|
auto newCastleInt = std::make_shared<CCastleInterface>(town);
|
|
|
|
|
|
- GH.pushInt(newCastleInt);
|
|
|
+ GH.windows().pushWindow(newCastleInt);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int which, si64 val)
|
|
|
@@ -447,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.topInt().get()))
|
|
|
+ for (auto ctw : GH.windows().findWindows<CAltarWindow>())
|
|
|
ctw->setExpToLevel();
|
|
|
}
|
|
|
else
|
|
|
@@ -457,11 +459,8 @@ 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.topInt().get());
|
|
|
- if (cuw) //university window is open
|
|
|
- {
|
|
|
- GH.totalRedraw();
|
|
|
- }
|
|
|
+ for (auto cuw : GH.windows().findWindows<CUniversityWindow>())
|
|
|
+ cuw->redraw();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::heroManaPointsChanged(const CGHeroInstance * hero)
|
|
|
@@ -480,10 +479,10 @@ void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
|
|
|
void CPlayerInterface::receivedResource()
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- if (CMarketplaceWindow *mw = dynamic_cast<CMarketplaceWindow *>(GH.topInt().get()))
|
|
|
+ for (auto mw : GH.windows().findWindows<CMarketplaceWindow>())
|
|
|
mw->resourceChanged();
|
|
|
|
|
|
- GH.totalRedraw();
|
|
|
+ GH.windows().totalRedraw();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill>& skills, QueryID queryID)
|
|
|
@@ -491,7 +490,7 @@ void CPlayerInterface::heroGotLevel(const CGHeroInstance *hero, PrimarySkill::Pr
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
waitWhileDialog();
|
|
|
CCS->soundh->playSound(soundBase::heroNewLevel);
|
|
|
- GH.pushIntT<CLevelWindow>(hero, pskill, skills, [=](ui32 selection)
|
|
|
+ GH.windows().createAndPushWindow<CLevelWindow>(hero, pskill, skills, [=](ui32 selection)
|
|
|
{
|
|
|
cb->selectionMade(selection, queryID);
|
|
|
});
|
|
|
@@ -502,7 +501,7 @@ void CPlayerInterface::commanderGotLevel (const CCommanderInstance * commander,
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
waitWhileDialog();
|
|
|
CCS->soundh->playSound(soundBase::heroNewLevel);
|
|
|
- GH.pushIntT<CStackWindow>(commander, skills, [=](ui32 selection)
|
|
|
+ GH.windows().createAndPushWindow<CStackWindow>(commander, skills, [=](ui32 selection)
|
|
|
{
|
|
|
cb->selectionMade(selection, queryID);
|
|
|
});
|
|
|
@@ -537,17 +536,15 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
|
|
castleInt->heroes->update();
|
|
|
castleInt->redraw();
|
|
|
}
|
|
|
- for (auto isa : GH.listInt)
|
|
|
+
|
|
|
+ for (auto ki : GH.windows().findWindows<CKingdomInterface>())
|
|
|
{
|
|
|
- CKingdomInterface *ki = dynamic_cast<CKingdomInterface*>(isa.get());
|
|
|
- if (ki)
|
|
|
- {
|
|
|
- ki->townChanged(town);
|
|
|
- ki->updateGarrisons();
|
|
|
- ki->redraw();
|
|
|
- }
|
|
|
+ ki->townChanged(town);
|
|
|
+ ki->updateGarrisons();
|
|
|
+ ki->redraw();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
void CPlayerInterface::heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
@@ -589,20 +586,16 @@ void CPlayerInterface::garrisonsChanged(std::vector<const CGObjectInstance *> ob
|
|
|
adventureInt->onTownChanged(town);
|
|
|
}
|
|
|
|
|
|
- for (auto & elem : GH.listInt)
|
|
|
- {
|
|
|
- CGarrisonHolder *cgh = dynamic_cast<CGarrisonHolder*>(elem.get());
|
|
|
- if (cgh)
|
|
|
- cgh->updateGarrisons();
|
|
|
+ for (auto cgh : GH.windows().findWindows<CGarrisonHolder>())
|
|
|
+ cgh->updateGarrisons();
|
|
|
|
|
|
- if (CTradeWindow *cmw = dynamic_cast<CTradeWindow*>(elem.get()))
|
|
|
- {
|
|
|
- if (vstd::contains(objs, cmw->hero))
|
|
|
- cmw->garrisonChanged();
|
|
|
- }
|
|
|
+ for (auto cmw : GH.windows().findWindows<CTradeWindow>())
|
|
|
+ {
|
|
|
+ if (vstd::contains(objs, cmw->hero))
|
|
|
+ cmw->garrisonChanged();
|
|
|
}
|
|
|
|
|
|
- GH.totalRedraw();
|
|
|
+ GH.windows().totalRedraw();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::buildChanged(const CGTownInstance *town, BuildingID buildingID, int what) //what: 1 - built, 2 - demolished
|
|
|
@@ -861,7 +854,7 @@ void CPlayerInterface::battleEnd(const BattleResult *br, QueryID queryID)
|
|
|
{
|
|
|
cb->selectionMade(selection, queryID);
|
|
|
};
|
|
|
- GH.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();
|
|
|
@@ -1015,7 +1008,7 @@ void CPlayerInterface::showInfoDialog(EInfoWindowMode type, const std::string &t
|
|
|
waitWhileDialog(); //Fix for mantis #98
|
|
|
adventureInt->showInfoBoxMessage(components, text, timer);
|
|
|
|
|
|
- if (makingTurn && GH.listInt.size() && LOCPLINT == this)
|
|
|
+ if (makingTurn && GH.windows().count() > 0 && LOCPLINT == this)
|
|
|
CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID));
|
|
|
return;
|
|
|
}
|
|
|
@@ -1056,12 +1049,12 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector
|
|
|
}
|
|
|
std::shared_ptr<CInfoWindow> temp = CInfoWindow::create(text, playerID, components);
|
|
|
|
|
|
- if (makingTurn && GH.listInt.size() && LOCPLINT == this)
|
|
|
+ if (makingTurn && GH.windows().count() > 0 && LOCPLINT == this)
|
|
|
{
|
|
|
CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID));
|
|
|
showingDialog->set(true);
|
|
|
stopMovement(); // interrupt movement to show dialog
|
|
|
- GH.pushInt(temp);
|
|
|
+ GH.windows().pushWindow(temp);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1121,7 +1114,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
|
|
|
int charperline = 35;
|
|
|
if (pom.size() > 1)
|
|
|
charperline = 50;
|
|
|
- GH.pushIntT<CSelWindow>(text, playerID, charperline, intComps, pom, askID);
|
|
|
+ GH.windows().createAndPushWindow<CSelWindow>(text, playerID, charperline, intComps, pom, askID);
|
|
|
intComps[0]->clickLeft(true, false);
|
|
|
}
|
|
|
}
|
|
|
@@ -1170,7 +1163,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.pushInt(wnd);
|
|
|
+ GH.windows().pushWindow(wnd);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::tileRevealed(const std::unordered_set<int3> &pos)
|
|
|
@@ -1189,7 +1182,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.pushIntT<CHeroWindow>(hero);
|
|
|
+ GH.windows().createAndPushWindow<CHeroWindow>(hero);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
|
|
|
@@ -1197,27 +1190,22 @@ 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.topInt().get());
|
|
|
- CCastleInterface * castleInterface = dynamic_cast<CCastleInterface*>(GH.topInt().get());
|
|
|
-
|
|
|
- if (fortScreen)
|
|
|
+ for (auto fortScreen : GH.windows().findWindows<CFortScreen>())
|
|
|
fortScreen->creaturesChangedEventHandler();
|
|
|
- else if(castleInterface)
|
|
|
+
|
|
|
+ for (auto castleInterface : GH.windows().findWindows<CCastleInterface>())
|
|
|
castleInterface->creaturesChangedEventHandler();
|
|
|
|
|
|
- for(auto isa : GH.listInt)
|
|
|
- {
|
|
|
- CKingdomInterface *ki = dynamic_cast<CKingdomInterface*>(isa.get());
|
|
|
- if (ki && townObj)
|
|
|
+ if (townObj)
|
|
|
+ for (auto ki : GH.windows().findWindows<CKingdomInterface>())
|
|
|
ki->townChanged(townObj);
|
|
|
- }
|
|
|
}
|
|
|
- else if(town && GH.listInt.size() && (town->ID == Obj::CREATURE_GENERATOR1
|
|
|
+ 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.topInt().get());
|
|
|
- if (crw && crw->dwelling == town)
|
|
|
- crw->availableCreaturesChanged();
|
|
|
+ for (auto crw : GH.windows().findWindows<CRecruitmentWindow>())
|
|
|
+ if (crw->dwelling == town)
|
|
|
+ crw->availableCreaturesChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1283,7 +1271,7 @@ void CPlayerInterface::showGarrisonDialog( const CArmedInstance *up, const CGHer
|
|
|
|
|
|
auto cgw = std::make_shared<CGarrisonWindow>(up, down, removableUnits);
|
|
|
cgw->quit->addCallback(onEnd);
|
|
|
- GH.pushInt(cgw);
|
|
|
+ GH.windows().pushWindow(cgw);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1341,7 +1329,7 @@ void CPlayerInterface::showHeroExchange(ObjectInstanceID hero1, ObjectInstanceID
|
|
|
void CPlayerInterface::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID query)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- GH.pushIntT<CExchangeWindow>(hero1, hero2, query);
|
|
|
+ GH.windows().createAndPushWindow<CExchangeWindow>(hero1, hero2, query);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
|
|
|
@@ -1402,7 +1390,7 @@ void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, const C
|
|
|
{
|
|
|
LOCPLINT->cb->recruitCreatures(dwelling, dst, id, count, -1);
|
|
|
};
|
|
|
- GH.pushIntT<CRecruitmentWindow>(dwelling, level, dst, recruitCb);
|
|
|
+ GH.windows().createAndPushWindow<CRecruitmentWindow>(dwelling, level, dst, recruitCb);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::waitWhileDialog(bool unlockPim)
|
|
|
@@ -1425,7 +1413,7 @@ void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
|
|
|
auto state = obj->shipyardStatus();
|
|
|
TResources cost;
|
|
|
obj->getBoatCost(cost);
|
|
|
- GH.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 )
|
|
|
@@ -1449,7 +1437,7 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
|
|
|
adventureInt->centerOnTile(pos);
|
|
|
if (focusTime)
|
|
|
{
|
|
|
- GH.totalRedraw();
|
|
|
+ GH.windows().totalRedraw();
|
|
|
{
|
|
|
auto unlockPim = vstd::makeUnlockGuard(*pim);
|
|
|
IgnoreEvents ignore(*this);
|
|
|
@@ -1518,7 +1506,7 @@ void CPlayerInterface::update()
|
|
|
if ((CSH->howManyPlayerInterfaces() <= 1 || makingTurn) && !dialogs.empty() && !showingDialog->get())
|
|
|
{
|
|
|
showingDialog->set(true);
|
|
|
- GH.pushInt(dialogs.front());
|
|
|
+ GH.windows().pushWindow(dialogs.front());
|
|
|
dialogs.pop_front();
|
|
|
}
|
|
|
|
|
|
@@ -1527,7 +1515,7 @@ void CPlayerInterface::update()
|
|
|
// Handles mouse and key input
|
|
|
GH.updateTime();
|
|
|
GH.handleEvents();
|
|
|
- GH.simpleRedraw();
|
|
|
+ GH.windows().simpleRedraw();
|
|
|
}
|
|
|
|
|
|
int CPlayerInterface::getLastIndex( std::string namePrefix)
|
|
|
@@ -1593,7 +1581,7 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
|
|
|
if(adventureInt)
|
|
|
{
|
|
|
GH.terminate_cond->setn(true);
|
|
|
- GH.popInts(GH.listInt.size());
|
|
|
+ GH.windows().popWindows(GH.windows().count());
|
|
|
adventureInt.reset();
|
|
|
}
|
|
|
}
|
|
|
@@ -1639,7 +1627,7 @@ void CPlayerInterface::showPuzzleMap()
|
|
|
double ratio = 0;
|
|
|
int3 grailPos = cb->getGrailPos(&ratio);
|
|
|
|
|
|
- GH.pushIntT<CPuzzleWindow>(grailPos, ratio);
|
|
|
+ GH.windows().createAndPushWindow<CPuzzleWindow>(grailPos, ratio);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::viewWorldMap()
|
|
|
@@ -1651,8 +1639,8 @@ void CPlayerInterface::advmapSpellCast(const CGHeroInstance * caster, int spellI
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
|
|
|
- if(dynamic_cast<CSpellWindow *>(GH.topInt().get()))
|
|
|
- GH.popInts(1);
|
|
|
+ if(GH.windows().topWindow<CSpellWindow>())
|
|
|
+ GH.windows().popWindows(1);
|
|
|
|
|
|
if(spellID == SpellID::FLY || spellID == SpellID::WATER_WALK)
|
|
|
localState->erasePath(caster);
|
|
|
@@ -1714,50 +1702,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.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.pushIntT<CAltarWindow>(market, visitor, EMarketMode::CREATURE_EXP);
|
|
|
+ GH.windows().createAndPushWindow<CAltarWindow>(market, visitor, EMarketMode::CREATURE_EXP);
|
|
|
else if(market->allowsTrade(EMarketMode::CREATURE_UNDEAD))
|
|
|
- GH.pushIntT<CTransformerWindow>(market, visitor);
|
|
|
+ GH.windows().createAndPushWindow<CTransformerWindow>(market, visitor);
|
|
|
else if(!market->availableModes().empty())
|
|
|
- GH.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.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.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.topInt().get()))
|
|
|
+ for (auto cmw : GH.windows().findWindows<CMarketplaceWindow>())
|
|
|
cmw->artifactsChanged(false);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::showTavernWindow(const CGObjectInstance *townOrTavern)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- GH.pushIntT<CTavernWindow>(townOrTavern);
|
|
|
+ GH.windows().createAndPushWindow<CTavernWindow>(townOrTavern);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::showThievesGuildWindow (const CGObjectInstance * obj)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- GH.pushIntT<CThievesGuildWindow>(obj);
|
|
|
+ GH.windows().createAndPushWindow<CThievesGuildWindow>(obj);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::showQuestLog()
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- GH.pushIntT<CQuestLog>(LOCPLINT->cb->getMyQuests());
|
|
|
+ GH.windows().createAndPushWindow<CQuestLog>(LOCPLINT->cb->getMyQuests());
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
|
|
|
@@ -1808,12 +1796,9 @@ void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
adventureInt->onHeroChanged(hero);
|
|
|
- for(auto isa : GH.listInt)
|
|
|
- {
|
|
|
- auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
|
- if (artWin)
|
|
|
- artWin->artifactRemoved(al);
|
|
|
- }
|
|
|
+
|
|
|
+ for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
|
|
+ artWin->artifactRemoved(al);
|
|
|
|
|
|
waitWhileDialog();
|
|
|
}
|
|
|
@@ -1833,12 +1818,9 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
|
|
|
redraw = false;
|
|
|
}
|
|
|
|
|
|
- for(auto isa : GH.listInt)
|
|
|
- {
|
|
|
- auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
|
- if (artWin)
|
|
|
- artWin->artifactMoved(src, dst, redraw);
|
|
|
- }
|
|
|
+ for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
|
|
+ artWin->artifactMoved(src, dst, redraw);
|
|
|
+
|
|
|
waitWhileDialog();
|
|
|
}
|
|
|
|
|
|
@@ -1852,12 +1834,9 @@ void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
adventureInt->onHeroChanged(hero);
|
|
|
- for(auto isa : GH.listInt)
|
|
|
- {
|
|
|
- auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
|
- if (artWin)
|
|
|
- artWin->artifactAssembled(al);
|
|
|
- }
|
|
|
+
|
|
|
+ for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
|
|
+ artWin->artifactAssembled(al);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
|
|
@@ -1865,12 +1844,9 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
adventureInt->onHeroChanged(hero);
|
|
|
- for(auto isa : GH.listInt)
|
|
|
- {
|
|
|
- auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
|
- if (artWin)
|
|
|
- artWin->artifactDisassembled(al);
|
|
|
- }
|
|
|
+
|
|
|
+ for(auto artWin : GH.windows().findWindows<CArtifactHolder>())
|
|
|
+ artWin->artifactDisassembled(al);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::waitForAllDialogs(bool unlockPim)
|