1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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

@@ -30,26 +30,26 @@ private:
protected:
/// function that must be called if hero got level-up during grantReward call
void grantRewardAfterLevelup(const Rewardable::VisitInfo & reward, const CArmedInstance * army, const CGHeroInstance * hero) const;
void grantRewardAfterLevelup(IGameEventCallback & gameEvents, const Rewardable::VisitInfo & reward, const CArmedInstance * army, const CGHeroInstance * hero) const;
/// grants reward to hero
void grantRewardBeforeLevelup(const Rewardable::VisitInfo & reward, const CGHeroInstance * hero) const;
void grantRewardBeforeLevelup(IGameEventCallback & gameEvents, const Rewardable::VisitInfo & reward, const CGHeroInstance * hero) const;
virtual void grantRewardWithMessage(const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const;
void selectRewardWithMessage(const CGHeroInstance * contextHero, const std::vector<ui32> & rewardIndices, const MetaString & dialog) const;
void grantAllRewardsWithMessage(const CGHeroInstance * contextHero, const std::vector<ui32>& rewardIndices, bool markAsVisit) const;
virtual void grantRewardWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const;
void selectRewardWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, const std::vector<ui32> & rewardIndices, const MetaString & dialog) const;
void grantAllRewardsWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, const std::vector<ui32>& rewardIndices, bool markAsVisit) const;
std::vector<Component> loadComponents(const CGHeroInstance * contextHero, const std::vector<ui32> & rewardIndices) const;
void doHeroVisit(const CGHeroInstance *h) const;
void doHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance *h) const;
virtual const IObjectInterface * getObject() const = 0;
virtual bool wasVisitedBefore(const CGHeroInstance * hero) const = 0;
virtual bool wasVisited(PlayerColor player) const = 0;
virtual void markAsVisited(const CGHeroInstance * hero) const = 0;
virtual void markAsScouted(const CGHeroInstance * hero) const = 0;
virtual void grantReward(ui32 rewardID, const CGHeroInstance * hero) const = 0;
virtual void markAsVisited(IGameEventCallback & gameEvents, const CGHeroInstance * hero) const = 0;
virtual void markAsScouted(IGameEventCallback & gameEvents, const CGHeroInstance * hero) const = 0;
virtual void grantReward(IGameEventCallback & gameEvents, ui32 rewardID, const CGHeroInstance * hero) const = 0;
void onBlockingDialogAnswered(const CGHeroInstance * hero, int32_t answer) const;
void onBlockingDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance * hero, int32_t answer) const;
public:
/// filters list of visit info and returns rewards that can be granted to current hero