mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Pass pointer to actual caller in showBlockingDialog callWith
Fixes activation of all rewardable buildings in town on blocking dialog answer
This commit is contained in:
@@ -1078,9 +1078,9 @@ void CGameHandler::setOwner(const CGObjectInstance * obj, const PlayerColor owne
|
||||
}
|
||||
}
|
||||
|
||||
void CGameHandler::showBlockingDialog(BlockingDialog *iw)
|
||||
void CGameHandler::showBlockingDialog(const IObjectInterface * caller, BlockingDialog *iw)
|
||||
{
|
||||
auto dialogQuery = std::make_shared<CBlockingDialogQuery>(this, *iw);
|
||||
auto dialogQuery = std::make_shared<CBlockingDialogQuery>(this, caller, *iw);
|
||||
queries->addQuery(dialogQuery);
|
||||
iw->queryID = dialogQuery->queryID;
|
||||
sendToAllClients(iw);
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
void changePrimSkill(const CGHeroInstance * hero, PrimarySkill which, si64 val, bool abs=false) override;
|
||||
void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs=false) override;
|
||||
|
||||
void showBlockingDialog(BlockingDialog *iw) override;
|
||||
void showBlockingDialog(const IObjectInterface * caller, BlockingDialog *iw) override;
|
||||
void showTeleportDialog(TeleportDialog *iw) override;
|
||||
void showGarrisonDialog(ObjectInstanceID upobj, ObjectInstanceID hid, bool removableUnits) override;
|
||||
void showObjectWindow(const CGObjectInstance * object, EOpenWindowMode window, const CGHeroInstance * visitor, bool addQuery) override;
|
||||
|
||||
@@ -120,11 +120,12 @@ bool CGarrisonDialogQuery::blocksPack(const CPack * pack) const
|
||||
void CBlockingDialogQuery::notifyObjectAboutRemoval(const CGObjectInstance * visitedObject, const CGHeroInstance * visitingHero) const
|
||||
{
|
||||
assert(answer);
|
||||
visitedObject->blockingDialogAnswered(visitingHero, *answer);
|
||||
caller->blockingDialogAnswered(visitingHero, *answer);
|
||||
}
|
||||
|
||||
CBlockingDialogQuery::CBlockingDialogQuery(CGameHandler * owner, const BlockingDialog & bd):
|
||||
CDialogQuery(owner)
|
||||
CBlockingDialogQuery::CBlockingDialogQuery(CGameHandler * owner, const IObjectInterface * caller, const BlockingDialog & bd):
|
||||
CDialogQuery(owner),
|
||||
caller(caller)
|
||||
{
|
||||
this->bd = bd;
|
||||
addPlayer(bd.player);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
class CGHeroInstance;
|
||||
class CGObjectInstance;
|
||||
class IObjectInterface;
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
//Created when player starts turn or when player puts game on [ause
|
||||
@@ -60,9 +61,10 @@ public:
|
||||
class CBlockingDialogQuery : public CDialogQuery
|
||||
{
|
||||
public:
|
||||
const IObjectInterface * caller;
|
||||
BlockingDialog bd; //copy of pack... debug purposes
|
||||
|
||||
CBlockingDialogQuery(CGameHandler * owner, const BlockingDialog &bd);
|
||||
CBlockingDialogQuery(CGameHandler * owner, const IObjectInterface * caller, const BlockingDialog &bd);
|
||||
|
||||
void notifyObjectAboutRemoval(const CGObjectInstance * visitedObject, const CGHeroInstance * visitingHero) const override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user