1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-04 22:14:25 +02:00

blockingDialog functions: the answer parameter can be negative

This commit is contained in:
MichalZr6 2024-08-09 00:28:28 +02:00
parent 3f9e57d3f3
commit ffaaa7da15
20 changed files with 26 additions and 26 deletions

View File

@ -393,7 +393,7 @@ void CBank::battleFinished(const CGHeroInstance *hero, const BattleResult &resul
} }
} }
void CBank::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CBank::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if (answer) if (answer)
{ {

View File

@ -40,7 +40,7 @@ public:
bool isCoastVisitable() const override; bool isCoastVisitable() const override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
std::vector<Component> getPopupComponents(PlayerColor player) const override; std::vector<Component> getPopupComponents(PlayerColor player) const override;

View File

@ -523,7 +523,7 @@ void CGCreature::battleFinished(const CGHeroInstance *hero, const BattleResult &
} }
} }
void CGCreature::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGCreature::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
auto action = takenAction(hero); auto action = takenAction(hero);
if(!refusedJoining && action >= JOIN_FOR_FREE) //higher means price if(!refusedJoining && action >= JOIN_FOR_FREE) //higher means price

View File

@ -48,7 +48,7 @@ public:
void pickRandomObject(vstd::RNG & rand) override; void pickRandomObject(vstd::RNG & rand) override;
void newTurn(vstd::RNG & rand) const override; void newTurn(vstd::RNG & rand) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
CreatureID getCreature() const; CreatureID getCreature() const;
//stack formation depends on position, //stack formation depends on position,

View File

@ -516,7 +516,7 @@ void CGDwelling::battleFinished(const CGHeroInstance *hero, const BattleResult &
} }
} }
void CGDwelling::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGDwelling::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
auto relations = cb->getPlayerRelations(getOwner(), hero->getOwner()); auto relations = cb->getPlayerRelations(getOwner(), hero->getOwner());
if(stacksCount() > 0 && relations == PlayerRelations::ENEMIES) //guards present if(stacksCount() > 0 && relations == PlayerRelations::ENEMIES) //guards present

View File

@ -54,7 +54,7 @@ private:
void newTurn(vstd::RNG & rand) const override; void newTurn(vstd::RNG & rand) const override;
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override; void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
std::vector<Component> getPopupComponents(PlayerColor player) const override; std::vector<Component> getPopupComponents(PlayerColor player) const override;
void updateGuards() const; void updateGuards() const;

View File

@ -186,7 +186,7 @@ void CGPandoraBox::battleFinished(const CGHeroInstance *hero, const BattleResult
} }
} }
void CGPandoraBox::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGPandoraBox::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer) if(answer)
{ {

View File

@ -26,7 +26,7 @@ public:
void initObj(vstd::RNG & rand) override; void initObj(vstd::RNG & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
template <typename Handler> void serialize(Handler &h) template <typename Handler> void serialize(Handler &h)
{ {

View File

@ -385,7 +385,7 @@ void CTownRewardableBuilding::heroLevelUpDone(const CGHeroInstance *hero) const
grantRewardAfterLevelup(cb, configuration.info.at(selectedReward), town, hero); grantRewardAfterLevelup(cb, configuration.info.at(selectedReward), town, hero);
} }
void CTownRewardableBuilding::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CTownRewardableBuilding::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer == 0) if(answer == 0)
return; // player refused return; // player refused

View File

@ -133,7 +133,7 @@ public:
void initObj(vstd::RNG & rand) override; void initObj(vstd::RNG & rand) override;
/// applies player selection of reward /// applies player selection of reward
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
CTownRewardableBuilding(const BuildingID & index, BuildingSubID::EBuildingSubID subId, CGTownInstance * town, vstd::RNG & rand); CTownRewardableBuilding(const BuildingID & index, BuildingSubID::EBuildingSubID subId, CGTownInstance * town, vstd::RNG & rand);
CTownRewardableBuilding(IGameCallback *cb); CTownRewardableBuilding(IGameCallback *cb);

View File

@ -281,7 +281,7 @@ void CGTownInstance::setOwner(const PlayerColor & player) const
cb->setOwner(this, player); cb->setOwner(this, player);
} }
void CGTownInstance::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGTownInstance::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
for (auto building : bonusingBuildings) for (auto building : bonusingBuildings)
building->blockingDialogAnswered(hero, answer); building->blockingDialogAnswered(hero, answer);

View File

@ -223,7 +223,7 @@ public:
protected: protected:
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override; void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
void serializeJsonOptions(JsonSerializeFormat & handler) override; void serializeJsonOptions(JsonSerializeFormat & handler) override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
private: private:
FactionID randomizeFaction(vstd::RNG & rand); FactionID randomizeFaction(vstd::RNG & rand);

View File

@ -660,7 +660,7 @@ const CGCreature * CGSeerHut::getCreatureToKill(bool allowNull) const
return dynamic_cast<const CGCreature *>(o); return dynamic_cast<const CGCreature *>(o);
} }
void CGSeerHut::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGSeerHut::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
CRewardableObject::blockingDialogAnswered(hero, answer); CRewardableObject::blockingDialogAnswered(hero, answer);
if(answer) if(answer)
@ -865,7 +865,7 @@ void CGBorderGuard::onHeroVisit(const CGHeroInstance * h) const
} }
} }
void CGBorderGuard::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGBorderGuard::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if (answer) if (answer)
cb->removeObject(this, hero->getOwner()); cb->removeObject(this, hero->getOwner());

View File

@ -150,7 +150,7 @@ public:
std::vector<Component> getPopupComponents(const CGHeroInstance * hero) const override; std::vector<Component> getPopupComponents(const CGHeroInstance * hero) const override;
void newTurn(vstd::RNG & rand) const override; void newTurn(vstd::RNG & rand) const override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void getVisitText (MetaString &text, std::vector<Component> &components, bool FirstVisit, const CGHeroInstance * h = nullptr) const override; void getVisitText (MetaString &text, std::vector<Component> &components, bool FirstVisit, const CGHeroInstance * h = nullptr) const override;
virtual void init(vstd::RNG & rand); virtual void init(vstd::RNG & rand);
@ -229,7 +229,7 @@ public:
void initObj(vstd::RNG & rand) override; void initObj(vstd::RNG & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void getVisitText (MetaString &text, std::vector<Component> &components, bool FirstVisit, const CGHeroInstance * h = nullptr) const override; void getVisitText (MetaString &text, std::vector<Component> &components, bool FirstVisit, const CGHeroInstance * h = nullptr) const override;
void getRolloverText (MetaString &text, bool onHover) const; void getRolloverText (MetaString &text, bool onHover) const;

View File

@ -181,7 +181,7 @@ void CRewardableObject::heroLevelUpDone(const CGHeroInstance *hero) const
grantRewardAfterLevelup(cb, configuration.info.at(selectedReward), this, hero); grantRewardAfterLevelup(cb, configuration.info.at(selectedReward), this, hero);
} }
void CRewardableObject::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CRewardableObject::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer == 0) if(answer == 0)
{ {

View File

@ -63,7 +63,7 @@ public:
void heroLevelUpDone(const CGHeroInstance *hero) const override; void heroLevelUpDone(const CGHeroInstance *hero) const override;
/// applies player selection of reward /// applies player selection of reward
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void initObj(vstd::RNG & rand) override; void initObj(vstd::RNG & rand) override;

View File

@ -68,7 +68,7 @@ void IObjectInterface::preInit()
void IObjectInterface::battleFinished(const CGHeroInstance *hero, const BattleResult &result) const void IObjectInterface::battleFinished(const CGHeroInstance *hero, const BattleResult &result) const
{} {}
void IObjectInterface::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void IObjectInterface::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{} {}
void IObjectInterface::garrisonDialogClosed(const CGHeroInstance *hero) const void IObjectInterface::garrisonDialogClosed(const CGHeroInstance *hero) const

View File

@ -61,7 +61,7 @@ public:
//Called when queries created DURING HERO VISIT are resolved //Called when queries created DURING HERO VISIT are resolved
//First parameter is always hero that visited object and triggered the query //First parameter is always hero that visited object and triggered the query
virtual void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const; virtual void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const;
virtual void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const; virtual void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const;
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;

View File

@ -215,7 +215,7 @@ void CGMine::battleFinished(const CGHeroInstance *hero, const BattleResult &resu
} }
} }
void CGMine::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGMine::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer) if(answer)
cb->startBattleI(hero, this); cb->startBattleI(hero, this);
@ -348,7 +348,7 @@ void CGResource::battleFinished(const CGHeroInstance *hero, const BattleResult &
collectRes(hero->getOwner()); collectRes(hero->getOwner());
} }
void CGResource::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGResource::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer) if(answer)
cb->startBattleI(hero, this); cb->startBattleI(hero, this);
@ -915,7 +915,7 @@ void CGArtifact::battleFinished(const CGHeroInstance *hero, const BattleResult &
pick(hero); pick(hero);
} }
void CGArtifact::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const void CGArtifact::blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const
{ {
if(answer) if(answer)
cb->startBattleI(hero, this); cb->startBattleI(hero, this);

View File

@ -91,7 +91,7 @@ public:
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
std::string getObjectName() const override; std::string getObjectName() const override;
std::string getPopupText(PlayerColor player) const override; std::string getPopupText(PlayerColor player) const override;
@ -132,7 +132,7 @@ public:
void initObj(vstd::RNG & rand) override; void initObj(vstd::RNG & rand) override;
void pickRandomObject(vstd::RNG & rand) override; void pickRandomObject(vstd::RNG & rand) override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
std::string getHoverText(PlayerColor player) const override; std::string getHoverText(PlayerColor player) const override;
void collectRes(const PlayerColor & player) const; void collectRes(const PlayerColor & player) const;
@ -163,7 +163,7 @@ private:
void onHeroVisit(const CGHeroInstance * h) const override; void onHeroVisit(const CGHeroInstance * h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override; void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override; void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void flagMine(const PlayerColor & player) const; void flagMine(const PlayerColor & player) const;
void newTurn(vstd::RNG & rand) const override; void newTurn(vstd::RNG & rand) const override;