1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

vcmi: remove a bunch of duplicated showInfoDialog

These methods duplicated in almost every map object
Just replace it by one such method
This commit is contained in:
Konstantin 2023-03-08 01:32:21 +03:00
parent 8edba4fb06
commit 716dd9a43b
12 changed files with 63 additions and 143 deletions

View File

@ -875,28 +875,28 @@ void ApplyClientNetPackVisitor::visitOpenWindow(OpenWindow & pack)
{ {
switch(pack.window) switch(pack.window)
{ {
case OpenWindow::RECRUITMENT_FIRST: case EOpenWindowMode::RECRUITMENT_FIRST:
case OpenWindow::RECRUITMENT_ALL: case EOpenWindowMode::RECRUITMENT_ALL:
{ {
const CGDwelling *dw = dynamic_cast<const CGDwelling*>(cl.getObj(ObjectInstanceID(pack.id1))); const CGDwelling *dw = dynamic_cast<const CGDwelling*>(cl.getObj(ObjectInstanceID(pack.id1)));
const CArmedInstance *dst = dynamic_cast<const CArmedInstance*>(cl.getObj(ObjectInstanceID(pack.id2))); const CArmedInstance *dst = dynamic_cast<const CArmedInstance*>(cl.getObj(ObjectInstanceID(pack.id2)));
callInterfaceIfPresent(cl, dst->tempOwner, &IGameEventsReceiver::showRecruitmentDialog, dw, dst, pack.window == OpenWindow::RECRUITMENT_FIRST ? 0 : -1); callInterfaceIfPresent(cl, dst->tempOwner, &IGameEventsReceiver::showRecruitmentDialog, dw, dst, pack.window == EOpenWindowMode::RECRUITMENT_FIRST ? 0 : -1);
} }
break; break;
case OpenWindow::SHIPYARD_WINDOW: case EOpenWindowMode::SHIPYARD_WINDOW:
{ {
const IShipyard *sy = IShipyard::castFrom(cl.getObj(ObjectInstanceID(pack.id1))); const IShipyard *sy = IShipyard::castFrom(cl.getObj(ObjectInstanceID(pack.id1)));
callInterfaceIfPresent(cl, sy->o->tempOwner, &IGameEventsReceiver::showShipyardDialog, sy); callInterfaceIfPresent(cl, sy->o->tempOwner, &IGameEventsReceiver::showShipyardDialog, sy);
} }
break; break;
case OpenWindow::THIEVES_GUILD: case EOpenWindowMode::THIEVES_GUILD:
{ {
//displays Thieves' Guild window (when hero enters Den of Thieves) //displays Thieves' Guild window (when hero enters Den of Thieves)
const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id2)); const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id2));
callInterfaceIfPresent(cl, PlayerColor(pack.id1), &IGameEventsReceiver::showThievesGuildWindow, obj); callInterfaceIfPresent(cl, PlayerColor(pack.id1), &IGameEventsReceiver::showThievesGuildWindow, obj);
} }
break; break;
case OpenWindow::UNIVERSITY_WINDOW: case EOpenWindowMode::UNIVERSITY_WINDOW:
{ {
//displays University window (when hero enters University on adventure map) //displays University window (when hero enters University on adventure map)
const IMarket *market = IMarket::castFrom(cl.getObj(ObjectInstanceID(pack.id1))); const IMarket *market = IMarket::castFrom(cl.getObj(ObjectInstanceID(pack.id1)));
@ -904,7 +904,7 @@ void ApplyClientNetPackVisitor::visitOpenWindow(OpenWindow & pack)
callInterfaceIfPresent(cl, hero->tempOwner, &IGameEventsReceiver::showUniversityWindow, market, hero); callInterfaceIfPresent(cl, hero->tempOwner, &IGameEventsReceiver::showUniversityWindow, market, hero);
} }
break; break;
case OpenWindow::MARKET_WINDOW: case EOpenWindowMode::MARKET_WINDOW:
{ {
//displays Thieves' Guild window (when hero enters Den of Thieves) //displays Thieves' Guild window (when hero enters Den of Thieves)
const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id1)); const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id1));
@ -913,7 +913,7 @@ void ApplyClientNetPackVisitor::visitOpenWindow(OpenWindow & pack)
callInterfaceIfPresent(cl, cl.getTile(obj->visitablePos())->visitableObjects.back()->tempOwner, &IGameEventsReceiver::showMarketWindow, market, hero); callInterfaceIfPresent(cl, cl.getTile(obj->visitablePos())->visitableObjects.back()->tempOwner, &IGameEventsReceiver::showMarketWindow, market, hero);
} }
break; break;
case OpenWindow::HILL_FORT_WINDOW: case EOpenWindowMode::HILL_FORT_WINDOW:
{ {
//displays Hill fort window //displays Hill fort window
const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id1)); const CGObjectInstance *obj = cl.getObj(ObjectInstanceID(pack.id1));
@ -921,12 +921,12 @@ void ApplyClientNetPackVisitor::visitOpenWindow(OpenWindow & pack)
callInterfaceIfPresent(cl, cl.getTile(obj->visitablePos())->visitableObjects.back()->tempOwner, &IGameEventsReceiver::showHillFortWindow, obj, hero); callInterfaceIfPresent(cl, cl.getTile(obj->visitablePos())->visitableObjects.back()->tempOwner, &IGameEventsReceiver::showHillFortWindow, obj, hero);
} }
break; break;
case OpenWindow::PUZZLE_MAP: case EOpenWindowMode::PUZZLE_MAP:
{ {
callInterfaceIfPresent(cl, PlayerColor(pack.id1), &IGameEventsReceiver::showPuzzleMap); callInterfaceIfPresent(cl, PlayerColor(pack.id1), &IGameEventsReceiver::showPuzzleMap);
} }
break; break;
case OpenWindow::TAVERN_WINDOW: case EOpenWindowMode::TAVERN_WINDOW:
const CGObjectInstance *obj1 = cl.getObj(ObjectInstanceID(pack.id1)), const CGObjectInstance *obj1 = cl.getObj(ObjectInstanceID(pack.id1)),
*obj2 = cl.getObj(ObjectInstanceID(pack.id2)); *obj2 = cl.getObj(ObjectInstanceID(pack.id2));
callInterfaceIfPresent(cl, obj1->tempOwner, &IGameEventsReceiver::showTavernWindow, obj2); callInterfaceIfPresent(cl, obj1->tempOwner, &IGameEventsReceiver::showTavernWindow, obj2);

View File

@ -718,12 +718,7 @@ struct DLL_LINKAGE GiveHero : public CPackForClient
struct DLL_LINKAGE OpenWindow : public CPackForClient struct DLL_LINKAGE OpenWindow : public CPackForClient
{ {
enum EWindow EOpenWindowMode window;
{
EXCHANGE_WINDOW, RECRUITMENT_FIRST, RECRUITMENT_ALL, SHIPYARD_WINDOW, THIEVES_GUILD,
UNIVERSITY_WINDOW, HILL_FORT_WINDOW, MARKET_WINDOW, PUZZLE_MAP, TAVERN_WINDOW
};
ui8 window;
si32 id1 = -1; si32 id1 = -1;
si32 id2 = -1; si32 id2 = -1;

View File

@ -42,6 +42,20 @@ enum class EInfoWindowMode : uint8_t
INFO INFO
}; };
enum class EOpenWindowMode : uint8_t
{
EXCHANGE_WINDOW,
RECRUITMENT_FIRST,
RECRUITMENT_ALL,
SHIPYARD_WINDOW,
THIEVES_GUILD,
UNIVERSITY_WINDOW,
HILL_FORT_WINDOW,
MARKET_WINDOW,
PUZZLE_MAP,
TAVERN_WINDOW
};
struct DLL_LINKAGE CPack struct DLL_LINKAGE CPack
{ {
std::shared_ptr<CConnection> c; // Pointer to connection that pack received from std::shared_ptr<CConnection> c; // Pointer to connection that pack received from

View File

@ -36,23 +36,6 @@
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
///helpers
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID = 0)
{
InfoWindow iw;
iw.soundID = soundID;
iw.player = playerID;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
IObjectInterface::cb->sendAndApply(&iw);
}
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID = 0)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
}
static int lowestSpeed(const CGHeroInstance * chi) static int lowestSpeed(const CGHeroInstance * chi)
{ {
static const CSelector selectorSTACKS_SPEED = Selector::type()(Bonus::STACKS_SPEED); static const CSelector selectorSTACKS_SPEED = Selector::type()(Bonus::STACKS_SPEED);
@ -462,7 +445,7 @@ void CGHeroInstance::onHeroVisit(const CGHeroInstance * h) const
txt_id = 103; txt_id = 103;
} }
showInfoDialog(h,txt_id); h->showInfoDialog(txt_id);
} }
} }

View File

@ -22,16 +22,6 @@
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
///helpers
static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1)
{
OpenWindow ow;
ow.window = type;
ow.id1 = id1;
ow.id2 = id2;
IObjectInterface::cb->sendAndApply(&ow);
}
bool IMarket::getOffer(int id1, int id2, int &val1, int &val2, EMarketMode::EMarketMode mode) const bool IMarket::getOffer(int id1, int id2, int &val1, int &val2, EMarketMode::EMarketMode mode) const
{ {
switch(mode) switch(mode)
@ -205,7 +195,7 @@ std::vector<EMarketMode::EMarketMode> IMarket::availableModes() const
void CGMarket::onHeroVisit(const CGHeroInstance * h) const void CGMarket::onHeroVisit(const CGHeroInstance * h) const
{ {
openWindow(OpenWindow::MARKET_WINDOW,id.getNum(),h->id.getNum()); openWindow(EOpenWindowMode::MARKET_WINDOW,id.getNum(),h->id.getNum());
} }
int CGMarket::getMarketEfficiency() const int CGMarket::getMarketEfficiency() const
@ -339,7 +329,7 @@ std::vector<int> CGUniversity::availableItemsIds(EMarketMode::EMarketMode mode)
void CGUniversity::onHeroVisit(const CGHeroInstance * h) const void CGUniversity::onHeroVisit(const CGHeroInstance * h) const
{ {
openWindow(OpenWindow::UNIVERSITY_WINDOW,id.getNum(),h->id.getNum()); openWindow(EOpenWindowMode::UNIVERSITY_WINDOW,id.getNum(),h->id.getNum());
} }
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -25,23 +25,6 @@
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
///helpers
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID)
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.soundID = soundID;
iw.player = playerID;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
IObjectInterface::cb->sendAndApply(&iw);
}
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
}
void CGPandoraBox::initObj(CRandomGenerator & rand) void CGPandoraBox::initObj(CRandomGenerator & rand)
{ {
blockVisit = (ID==Obj::PANDORAS_BOX); //block only if it's really pandora's box (events also derive from that class) blockVisit = (ID==Obj::PANDORAS_BOX); //block only if it's really pandora's box (events also derive from that class)
@ -342,7 +325,7 @@ void CGPandoraBox::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answe
{ {
if(stacksCount() > 0) //if pandora's box is protected by army if(stacksCount() > 0) //if pandora's box is protected by army
{ {
showInfoDialog(hero,16,0); hero->showInfoDialog(16, 0, EInfoWindowMode::MODAL);
cb->startBattleI(hero, this); //grants things after battle cb->startBattleI(hero, this); //grants things after battle
} }
else if(message.empty() && resources.empty() else if(message.empty() && resources.empty()
@ -351,7 +334,7 @@ void CGPandoraBox::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answe
&& spells.empty() && creatures.stacksCount() > 0 && spells.empty() && creatures.stacksCount() > 0
&& gainedExp == 0 && manaDiff == 0 && moraleDiff == 0 && luckDiff == 0) //if it gives nothing without battle && gainedExp == 0 && manaDiff == 0 && moraleDiff == 0 && luckDiff == 0) //if it gives nothing without battle
{ {
showInfoDialog(hero,15,0); hero->showInfoDialog(15);
cb->removeObject(this); cb->removeObject(this);
} }
else //if it gives something without battle else //if it gives something without battle

View File

@ -383,8 +383,8 @@ void CGDwelling::heroAcceptsCreatures( const CGHeroInstance *h) const
ow.id1 = id.getNum(); ow.id1 = id.getNum();
ow.id2 = h->id.getNum(); ow.id2 = h->id.getNum();
ow.window = (ID == Obj::CREATURE_GENERATOR1 || ID == Obj::REFUGEE_CAMP) ow.window = (ID == Obj::CREATURE_GENERATOR1 || ID == Obj::REFUGEE_CAMP)
? OpenWindow::RECRUITMENT_FIRST ? EOpenWindowMode::RECRUITMENT_FIRST
: OpenWindow::RECRUITMENT_ALL; : EOpenWindowMode::RECRUITMENT_ALL;
cb->sendAndApply(&ow); cb->sendAndApply(&ow);
} }
} }

View File

@ -32,7 +32,7 @@ VCMI_LIB_NAMESPACE_BEGIN
IGameCallback * IObjectInterface::cb = nullptr; IGameCallback * IObjectInterface::cb = nullptr;
///helpers ///helpers
static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1) void IObjectInterface::openWindow(const EOpenWindowMode type, const int id1, const int id2)
{ {
OpenWindow ow; OpenWindow ow;
ow.window = type; ow.window = type;
@ -41,27 +41,16 @@ static void openWindow(const OpenWindow::EWindow type, const int id1, const int
IObjectInterface::cb->sendAndApply(&ow); IObjectInterface::cb->sendAndApply(&ow);
} }
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID) void IObjectInterface::showInfoDialog(const ui32 txtID, const ui16 soundID, EInfoWindowMode mode) const
{ {
InfoWindow iw; InfoWindow iw;
iw.soundID = soundID; iw.soundID = soundID;
iw.player = playerID; iw.player = getOwner();
iw.type = mode;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID); iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
IObjectInterface::cb->sendAndApply(&iw); IObjectInterface::cb->sendAndApply(&iw);
} }
/*static void showInfoDialog(const ObjectInstanceID heroID, const ui32 txtID, const ui16 soundID)
{
const PlayerColor playerID = IObjectInterface::cb->getOwner(heroID);
showInfoDialog(playerID,txtID,soundID);
}*/
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID = 0)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
}
///IObjectInterface ///IObjectInterface
void IObjectInterface::onHeroVisit(const CGHeroInstance * h) const void IObjectInterface::onHeroVisit(const CGHeroInstance * h) const
{} {}
@ -340,18 +329,18 @@ void CGObjectInstance::onHeroVisit( const CGHeroInstance * h ) const
{ {
case Obj::HILL_FORT: case Obj::HILL_FORT:
{ {
openWindow(OpenWindow::HILL_FORT_WINDOW,id.getNum(),h->id.getNum()); openWindow(EOpenWindowMode::HILL_FORT_WINDOW,id.getNum(),h->id.getNum());
} }
break; break;
case Obj::SANCTUARY: case Obj::SANCTUARY:
{ {
//You enter the sanctuary and immediately feel as if a great weight has been lifted off your shoulders. You feel safe here. //You enter the sanctuary and immediately feel as if a great weight has been lifted off your shoulders. You feel safe here.
showInfoDialog(h, 114); h->showInfoDialog(114);
} }
break; break;
case Obj::TAVERN: case Obj::TAVERN:
{ {
openWindow(OpenWindow::TAVERN_WINDOW,h->id.getNum(),id.getNum()); openWindow(EOpenWindowMode::TAVERN_WINDOW,h->id.getNum(),id.getNum());
} }
break; break;
} }

View File

@ -13,6 +13,7 @@
#include "../int3.h" #include "../int3.h"
#include "../HeroBonus.h" #include "../HeroBonus.h"
#include "../NetPacksBase.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
@ -57,7 +58,13 @@ public:
virtual void garrisonDialogClosed(const CGHeroInstance *hero) const; virtual void garrisonDialogClosed(const CGHeroInstance *hero) const;
virtual void heroLevelUpDone(const CGHeroInstance *hero) const; virtual void heroLevelUpDone(const CGHeroInstance *hero) const;
//unified interface, AI helpers //unified helper to show info dialog for object owner
virtual void showInfoDialog(const ui32 txtID, const ui16 soundID = 0, EInfoWindowMode mode = EInfoWindowMode::AUTO) const;
//unified helper to show a specific window
static void openWindow(const EOpenWindowMode type, const int id1, const int id2 = -1);
//unified interface, AI helpers
virtual bool wasVisited (PlayerColor player) const; virtual bool wasVisited (PlayerColor player) const;
virtual bool wasVisited (const CGHeroInstance * h) const; virtual bool wasVisited (const CGHeroInstance * h) const;

View File

@ -50,22 +50,6 @@ CQuest::CQuest():
{ {
} }
///helpers
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID = 0)
{
InfoWindow iw;
iw.soundID = soundID;
iw.player = playerID;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
IObjectInterface::cb->sendAndApply(&iw);
}
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID = 0)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
}
static std::string visitedTxt(const bool visited) static std::string visitedTxt(const bool visited)
{ {
int id = visited ? 352 : 353; int id = visited ? 352 : 353;
@ -1146,7 +1130,7 @@ void CGKeymasterTent::onHeroVisit( const CGHeroInstance * h ) const
} }
else else
txt_id=20; txt_id=20;
showInfoDialog(h, txt_id); h->showInfoDialog(txt_id);
} }
void CGBorderGuard::initObj(CRandomGenerator & rand) void CGBorderGuard::initObj(CRandomGenerator & rand)
@ -1182,7 +1166,7 @@ void CGBorderGuard::onHeroVisit(const CGHeroInstance * h) const
} }
else else
{ {
showInfoDialog(h, 18); h->showInfoDialog(18);
AddQuest aq; AddQuest aq;
aq.quest = QuestInfo (quest, this, visitablePos()); aq.quest = QuestInfo (quest, this, visitablePos());
@ -1207,7 +1191,7 @@ void CGBorderGate::onHeroVisit(const CGHeroInstance * h) const //TODO: passabili
{ {
if (!wasMyColorVisited (h->getOwner()) ) if (!wasMyColorVisited (h->getOwner()) )
{ {
showInfoDialog(h,18,0); h->showInfoDialog(18);
AddQuest aq; AddQuest aq;
aq.quest = QuestInfo (quest, this, visitablePos()); aq.quest = QuestInfo (quest, this, visitablePos());

View File

@ -34,32 +34,6 @@ ui8 CGObelisk::obeliskCount = 0; //how many obelisks are on map
std::map<TeamID, ui8> CGObelisk::visited; //map: team_id => how many obelisks has been visited std::map<TeamID, ui8> CGObelisk::visited; //map: team_id => how many obelisks has been visited
///helpers ///helpers
static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1)
{
OpenWindow ow;
ow.window = type;
ow.id1 = id1;
ow.id2 = id2;
IObjectInterface::cb->sendAndApply(&ow);
}
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID = 0)
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
if(soundID)
iw.soundID = soundID;
iw.player = playerID;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
IObjectInterface::cb->sendAndApply(&iw);
}
static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16 soundID = 0)
{
const PlayerColor playerID = h->getOwner();
showInfoDialog(playerID,txtID,soundID);
}
static std::string visitedTxt(const bool visited) static std::string visitedTxt(const bool visited)
{ {
int id = visited ? 352 : 353; int id = visited ? 352 : 353;
@ -386,7 +360,7 @@ void CGCreature::joinDecision(const CGHeroInstance *h, int cost, ui32 accept) co
} }
else //they fight else //they fight
{ {
showInfoDialog(h,87,0);//Insulted by your refusal of their offer, the monsters attack! h->showInfoDialog(87, 0, EInfoWindowMode::MODAL);//Insulted by your refusal of their offer, the monsters attack!
fight(h); fight(h);
} }
} }
@ -600,6 +574,7 @@ void CGCreature::giveReward(const CGHeroInstance * h) const
if(!iw.components.empty()) if(!iw.components.empty())
{ {
iw.type = EInfoWindowMode::AUTO;
iw.text.addTxt(MetaString::ADVOB_TXT, 183); // % has found treasure iw.text.addTxt(MetaString::ADVOB_TXT, 183); // % has found treasure
iw.text.addReplacement(h->getNameTranslated()); iw.text.addReplacement(h->getNameTranslated());
cb->showInfoDialog(&iw); cb->showInfoDialog(&iw);
@ -769,7 +744,7 @@ void CGMine::battleFinished(const CGHeroInstance *hero, const BattleResult &resu
{ {
if(isAbandoned()) if(isAbandoned())
{ {
showInfoDialog(hero->tempOwner, 85, 0); hero->showInfoDialog(85);
} }
flagMine(hero->tempOwner); flagMine(hero->tempOwner);
} }
@ -1080,7 +1055,7 @@ void CGMonolith::onHeroVisit( const CGHeroInstance * h ) const
logGlobal->debug("All exits blocked for monolith %d at %s", id.getNum(), pos.toString()); logGlobal->debug("All exits blocked for monolith %d at %s", id.getNum(), pos.toString());
} }
else else
showInfoDialog(h, 70, 0); h->showInfoDialog(70);
cb->showTeleportDialog(&td); cb->showTeleportDialog(&td);
} }
@ -1136,7 +1111,7 @@ void CGSubterraneanGate::onHeroVisit( const CGHeroInstance * h ) const
TeleportDialog td(h->tempOwner, channel); TeleportDialog td(h->tempOwner, channel);
if(cb->isTeleportChannelImpassable(channel)) if(cb->isTeleportChannelImpassable(channel))
{ {
showInfoDialog(h,153,0);//Just inside the entrance you find a large pile of rubble blocking the tunnel. You leave discouraged. h->showInfoDialog(153);//Just inside the entrance you find a large pile of rubble blocking the tunnel. You leave discouraged.
logGlobal->debug("Cannot find exit subterranean gate for %d at %s", id.getNum(), pos.toString()); logGlobal->debug("Cannot find exit subterranean gate for %d at %s", id.getNum(), pos.toString());
td.impassable = true; td.impassable = true;
} }
@ -1860,7 +1835,7 @@ void CGMagi::onHeroVisit(const CGHeroInstance * h) const
{ {
if (ID == Obj::HUT_OF_MAGI) if (ID == Obj::HUT_OF_MAGI)
{ {
showInfoDialog(h, 61); h->showInfoDialog(61);
if (!eyelist[subID].empty()) if (!eyelist[subID].empty())
{ {
@ -1890,7 +1865,7 @@ void CGMagi::onHeroVisit(const CGHeroInstance * h) const
} }
else if (ID == Obj::EYE_OF_MAGI) else if (ID == Obj::EYE_OF_MAGI)
{ {
showInfoDialog(h, 48); h->showInfoDialog(48);
} }
} }
@ -1988,7 +1963,7 @@ void CGShipyard::onHeroVisit( const CGHeroInstance * h ) const
} }
else else
{ {
openWindow(OpenWindow::SHIPYARD_WINDOW,id.getNum(),h->id.getNum()); openWindow(EOpenWindowMode::SHIPYARD_WINDOW,id.getNum(),h->id.getNum());
} }
} }
@ -2028,12 +2003,12 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
} }
else //if he cannot afford else //if he cannot afford
{ {
showInfoDialog(h, 28); h->showInfoDialog(28);
} }
} }
else //if he already visited carographer else //if he already visited carographer
{ {
showInfoDialog(h, 24); h->showInfoDialog(24);
} }
} }
@ -2092,7 +2067,7 @@ void CGObelisk::onHeroVisit( const CGHeroInstance * h ) const
// increment general visited obelisks counter // increment general visited obelisks counter
cb->setObjProperty(id, CGObelisk::OBJPROP_INC, team.getNum()); cb->setObjProperty(id, CGObelisk::OBJPROP_INC, team.getNum());
openWindow(OpenWindow::PUZZLE_MAP, h->tempOwner.getNum()); openWindow(EOpenWindowMode::PUZZLE_MAP, h->tempOwner.getNum());
// mark that particular obelisk as visited for all players in the team // mark that particular obelisk as visited for all players in the team
for(const auto & color : ts->players) for(const auto & color : ts->players)
@ -2153,7 +2128,7 @@ void CGLighthouse::onHeroVisit( const CGHeroInstance * h ) const
{ {
PlayerColor oldOwner = tempOwner; PlayerColor oldOwner = tempOwner;
cb->setOwner(this,h->tempOwner); //not ours? flag it! cb->setOwner(this,h->tempOwner); //not ours? flag it!
showInfoDialog(h, 69); h->showInfoDialog(69);
giveBonusTo(h->tempOwner); giveBonusTo(h->tempOwner);
if(oldOwner < PlayerColor::PLAYER_LIMIT) //remove bonus from old owner if(oldOwner < PlayerColor::PLAYER_LIMIT) //remove bonus from old owner

View File

@ -5721,7 +5721,7 @@ void CGameHandler::showGarrisonDialog(ObjectInstanceID upobj, ObjectInstanceID h
void CGameHandler::showThievesGuildWindow(PlayerColor player, ObjectInstanceID requestingObjId) void CGameHandler::showThievesGuildWindow(PlayerColor player, ObjectInstanceID requestingObjId)
{ {
OpenWindow ow; OpenWindow ow;
ow.window = OpenWindow::THIEVES_GUILD; ow.window = EOpenWindowMode::THIEVES_GUILD;
ow.id1 = player.getNum(); ow.id1 = player.getNum();
ow.id2 = requestingObjId.getNum(); ow.id2 = requestingObjId.getNum();
sendAndApply(&ow); sendAndApply(&ow);