1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Completely remove IGameCallback class

- CClient now inherits directly from CPrivilegedInfoCallback, like
IGameCallback did before. However CClient no longer needs dummy
implementation of IGameEventCallback
- CGObjectInstance hierarchy now uses CPrivilegedInfoCallback for
callback. Actual events can only be emitted in calls that receive
IGameEventCallback pointer, e.g. heroVisit
- CGameHandler now inherits directly from both CPrivilegedInfoCallback
and IGameEventCallback as it did before via IGameCallback
This commit is contained in:
Ivan Savenko
2025-05-13 15:24:45 +03:00
parent f7d08a7288
commit 716da918f8
109 changed files with 854 additions and 933 deletions

View File

@@ -25,13 +25,13 @@ protected:
/// reward selected by player, no serialize
ui16 selectedReward = 0;
void doStartBattle(const CGHeroInstance * hero) const;
void doStartBattle(IGameEventCallback & gameEvents, const CGHeroInstance * hero) const;
void grantReward(ui32 rewardID, const CGHeroInstance * hero) const override;
void markAsVisited(const CGHeroInstance * hero) const override;
void grantReward(IGameEventCallback & gameEvents, ui32 rewardID, const CGHeroInstance * hero) const override;
void markAsVisited(IGameEventCallback & gameEvents, const CGHeroInstance * hero) const override;
const IObjectInterface * getObject() const override;
void markAsScouted(const CGHeroInstance * hero) const override;
void markAsScouted(IGameEventCallback & gameEvents, const CGHeroInstance * hero) const override;
/// return true if this object was "cleared" before and no longer has rewards applicable to selected hero
/// unlike wasVisited, this method uses information not available to player owner, for example, if object was cleared by another player before
@@ -55,19 +55,19 @@ public:
bool wasScouted(PlayerColor player) const;
/// gives reward to player or ask for choice in case of multiple rewards
void onHeroVisit(const CGHeroInstance *h) const override;
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance *h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void garrisonDialogClosed(const CGHeroInstance *hero) const override;
void battleFinished(IGameEventCallback & gameEvents, const CGHeroInstance *hero, const BattleResult &result) const override;
void garrisonDialogClosed(IGameEventCallback & gameEvents, const CGHeroInstance *hero) const override;
///possibly resets object state
void newTurn(vstd::RNG & rand) const override;
void newTurn(IGameEventCallback & gameEvents) const override;
/// gives second part of reward after hero level-ups for proper granting of spells/mana
void heroLevelUpDone(const CGHeroInstance *hero) const override;
void heroLevelUpDone(IGameEventCallback & gameEvents, const CGHeroInstance *hero) const override;
/// applies player selection of reward
void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void blockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, int32_t answer) const override;
void initObj(vstd::RNG & rand) override;
@@ -77,7 +77,7 @@ public:
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
CRewardableObject(IGameCallback *cb);
CRewardableObject(CPrivilegedInfoCallback *cb);
std::string getHoverText(PlayerColor player) const override;
std::string getHoverText(const CGHeroInstance * hero) const override;