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

@@ -24,9 +24,9 @@ public:
MetaString message;
void initObj(vstd::RNG & rand) override;
void onHeroVisit(const CGHeroInstance * h) const override;
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
void battleFinished(IGameEventCallback & gameEvents, const CGHeroInstance *hero, const BattleResult &result) const override;
void blockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, int32_t answer) const override;
template <typename Handler> void serialize(Handler &h)
{
@@ -34,7 +34,7 @@ public:
h & message;
}
protected:
void grantRewardWithMessage(const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const override;
void grantRewardWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const override;
virtual void init();
void serializeJsonOptions(JsonSerializeFormat & handler) override;
@@ -59,14 +59,14 @@ public:
h & humanActivate;
}
void onHeroVisit(const CGHeroInstance * h) const override;
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
protected:
void grantRewardWithMessage(const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const override;
void grantRewardWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const override;
void init() override;
void serializeJsonOptions(JsonSerializeFormat & handler) override;
private:
void activated(const CGHeroInstance * h) const;
void activated(IGameEventCallback & gameEvents, const CGHeroInstance * h) const;
};
VCMI_LIB_NAMESPACE_END