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:
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
MetaString message;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h)
|
||||
@@ -70,8 +70,8 @@ public:
|
||||
|
||||
void initObj(vstd::RNG &rand) override;
|
||||
bool passableFor(PlayerColor color) const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void battleFinished(IGameEventCallback & gameEvents, const CGHeroInstance *hero, const BattleResult &result) const override;
|
||||
|
||||
const IOwnableObject * asOwnable() const final;
|
||||
ResourceSet dailyIncome() const override;
|
||||
@@ -96,16 +96,16 @@ public:
|
||||
|
||||
MetaString message;
|
||||
|
||||
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;
|
||||
|
||||
std::string getObjectName() const override;
|
||||
std::string getPopupText(PlayerColor player) const override;
|
||||
std::string getPopupText(const CGHeroInstance * hero) const override;
|
||||
std::vector<Component> getPopupComponents(PlayerColor player) const override;
|
||||
|
||||
void pick( const CGHeroInstance * h ) const;
|
||||
void pick(IGameEventCallback & gameEvents, const CGHeroInstance * h) const;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
void pickRandomObject(vstd::RNG & rand) override;
|
||||
|
||||
@@ -146,11 +146,11 @@ public:
|
||||
private:
|
||||
using CArmedInstance::CArmedInstance;
|
||||
|
||||
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;
|
||||
|
||||
void flagMine(const PlayerColor & player) const;
|
||||
void flagMine(IGameEventCallback & gameEvents, const PlayerColor & player) const;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
|
||||
std::string getObjectName() const override;
|
||||
@@ -200,7 +200,7 @@ protected:
|
||||
enum EType {UNKNOWN, ENTRANCE, EXIT, BOTH};
|
||||
EType type = EType::UNKNOWN;
|
||||
|
||||
ObjectInstanceID getRandomExit(const CGHeroInstance * h) const;
|
||||
ObjectInstanceID getRandomExit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const;
|
||||
|
||||
|
||||
public:
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
std::vector<ObjectInstanceID> getAllEntrances(bool excludeCurrent = false) const;
|
||||
std::vector<ObjectInstanceID> getAllExits(bool excludeCurrent = false) const;
|
||||
|
||||
virtual void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const = 0;
|
||||
virtual void teleportDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const = 0;
|
||||
|
||||
static bool isTeleport(const CGObjectInstance * dst);
|
||||
static bool isConnected(const CGTeleport * src, const CGTeleport * dst);
|
||||
@@ -236,8 +236,8 @@ class DLL_LINKAGE CGMonolith : public CGTeleport
|
||||
TeleportChannelID findMeChannel(const std::vector<Obj> & IDs, MapObjectSubID SubID) const;
|
||||
|
||||
protected:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void teleportDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
|
||||
public:
|
||||
@@ -251,13 +251,13 @@ public:
|
||||
|
||||
class DLL_LINKAGE CGSubterraneanGate : public CGMonolith
|
||||
{
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
|
||||
public:
|
||||
using CGMonolith::CGMonolith;
|
||||
|
||||
static void postInit(IGameCallback * cb);
|
||||
static void postInit(CPrivilegedInfoCallback * cb);
|
||||
|
||||
template <typename Handler> void serialize(Handler &h)
|
||||
{
|
||||
@@ -267,8 +267,8 @@ public:
|
||||
|
||||
class DLL_LINKAGE CGWhirlpool : public CGMonolith
|
||||
{
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void teleportDialogAnswered(IGameEventCallback & gameEvents, const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
||||
static bool isProtected( const CGHeroInstance * h );
|
||||
|
||||
public:
|
||||
@@ -285,7 +285,7 @@ class DLL_LINKAGE CGSirens : public CGObjectInstance
|
||||
public:
|
||||
using CGObjectInstance::CGObjectInstance;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
std::string getHoverText(const CGHeroInstance * hero) const override;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
AnimationPath overlayAnimation; //waves animations
|
||||
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
|
||||
|
||||
CGBoat(IGameCallback * cb);
|
||||
CGBoat(CPrivilegedInfoCallback * cb);
|
||||
bool isCoastVisitable() const override;
|
||||
|
||||
void setBoardedHero(const CGHeroInstance * hero);
|
||||
@@ -351,7 +351,7 @@ class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard, public
|
||||
|
||||
protected:
|
||||
void getOutOffsets(std::vector<int3> & offsets) const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
const IObjectInterface * getObject() const override;
|
||||
BoatId getBoatType() const override;
|
||||
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
using CGObjectInstance::CGObjectInstance;
|
||||
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
|
||||
class DLL_LINKAGE CGDenOfthieves : public CGObjectInstance
|
||||
{
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
public:
|
||||
using CGObjectInstance::CGObjectInstance;
|
||||
};
|
||||
@@ -398,7 +398,7 @@ class DLL_LINKAGE CGObelisk : public CTeamVisited
|
||||
public:
|
||||
using CTeamVisited::CTeamVisited;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void initObj(vstd::RNG & rand) override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
std::string getObjectDescription(PlayerColor player) const;
|
||||
@@ -429,7 +429,7 @@ class DLL_LINKAGE HillFort : public CGObjectInstance, public ICreatureUpgrader
|
||||
std::vector<int> upgradeCostPercentage;
|
||||
|
||||
protected:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroVisit(IGameEventCallback & gameEvents, const CGHeroInstance * h) const override;
|
||||
void fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &stack) const override;
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user