mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +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:
@@ -13,13 +13,14 @@
|
||||
#include <vcmi/Environment.h>
|
||||
|
||||
#include "../lib/callback/IClient.h"
|
||||
#include "../lib/callback/IGameCallback.h"
|
||||
#include "../lib/callback/CPrivilegedInfoCallback.h"
|
||||
#include "../lib/ConditionalWait.h"
|
||||
#include "../lib/ResourceSet.h"
|
||||
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
struct CPackForClient;
|
||||
struct CPackForServer;
|
||||
class IBattleEventsReceiver;
|
||||
class CBattleGameInterface;
|
||||
@@ -121,7 +122,7 @@ public:
|
||||
};
|
||||
|
||||
/// Class which handles client - server logic
|
||||
class CClient : public IGameCallback, public Environment, public IClient
|
||||
class CClient : public CPrivilegedInfoCallback, public Environment, public IClient
|
||||
{
|
||||
std::shared_ptr<CGameState> gamestate;
|
||||
public:
|
||||
@@ -176,70 +177,8 @@ public:
|
||||
friend class CCallback; //handling players actions
|
||||
friend class CBattleCallback; //handling players actions
|
||||
|
||||
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> & spells) override {};
|
||||
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override {};
|
||||
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;};
|
||||
void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {};
|
||||
void setOwner(const CGObjectInstance * obj, PlayerColor owner) override {};
|
||||
void giveExperience(const CGHeroInstance * hero, TExpType val) override {};
|
||||
void changePrimSkill(const CGHeroInstance * hero, PrimarySkill which, si64 val, bool abs = false) override {};
|
||||
void changeSecSkill(const CGHeroInstance * hero, SecondarySkill which, int val, bool abs = false) override {};
|
||||
|
||||
void showBlockingDialog(const IObjectInterface * caller, BlockingDialog * iw) override {};
|
||||
void showGarrisonDialog(ObjectInstanceID upobj, ObjectInstanceID hid, bool removableUnits) override {};
|
||||
void showTeleportDialog(TeleportDialog * iw) override {};
|
||||
void showObjectWindow(const CGObjectInstance * object, EOpenWindowMode window, const CGHeroInstance * visitor, bool addQuery) override {};
|
||||
void giveResource(PlayerColor player, GameResID which, int val) override {};
|
||||
void giveResources(PlayerColor player, ResourceSet resources) override {};
|
||||
|
||||
void giveCreatures(const CArmedInstance * objid, const CGHeroInstance * h, const CCreatureSet & creatures, bool remove) override {};
|
||||
void takeCreatures(ObjectInstanceID objid, const std::vector<CStackBasicDescriptor> & creatures, bool forceRemoval) override {};
|
||||
bool changeStackType(const StackLocation & sl, const CCreature * c) override {return false;};
|
||||
bool changeStackCount(const StackLocation & sl, TQuantity count, bool absoluteValue = false) override {return false;};
|
||||
bool insertNewStack(const StackLocation & sl, const CCreature * c, TQuantity count) override {return false;};
|
||||
bool eraseStack(const StackLocation & sl, bool forceRemoval = false) override {return false;};
|
||||
bool swapStacks(const StackLocation & sl1, const StackLocation & sl2) override {return false;}
|
||||
bool addToSlot(const StackLocation & sl, const CCreature * c, TQuantity count) override {return false;}
|
||||
void tryJoiningArmy(const CArmedInstance * src, const CArmedInstance * dst, bool removeObjWhenFinished, bool allowMerging) override {}
|
||||
bool moveStack(const StackLocation & src, const StackLocation & dst, TQuantity count = -1) override {return false;}
|
||||
|
||||
void removeAfterVisit(const ObjectInstanceID & id) override {};
|
||||
bool swapGarrisonOnSiege(ObjectInstanceID tid) override {return false;};
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos) override {return false;};
|
||||
bool giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos) override {return false;};
|
||||
bool putArtifact(const ArtifactLocation & al, const ArtifactInstanceID & id, std::optional<bool> askAssemble) override {return false;};
|
||||
void removeArtifact(const ArtifactLocation & al) override {};
|
||||
bool moveArtifact(const PlayerColor & player, const ArtifactLocation & al1, const ArtifactLocation & al2) override {return false;};
|
||||
|
||||
void heroVisitCastle(const CGTownInstance * obj, const CGHeroInstance * hero) override {};
|
||||
void visitCastleObjects(const CGTownInstance * obj, const CGHeroInstance * hero) override {};
|
||||
void stopHeroVisitCastle(const CGTownInstance * obj, const CGHeroInstance * hero) override {};
|
||||
void startBattle(const CArmedInstance * army1, const CArmedInstance * army2, int3 tile, const CGHeroInstance * hero1, const CGHeroInstance * hero2, const BattleLayout & layout, const CGTownInstance * town) override {}; //use hero=nullptr for no hero
|
||||
void startBattle(const CArmedInstance * army1, const CArmedInstance * army2) override {}; //if any of armies is hero, hero will be used
|
||||
bool moveHero(ObjectInstanceID hid, int3 dst, EMovementMode movementMode, bool transit = false, PlayerColor asker = PlayerColor::NEUTRAL) override {return false;};
|
||||
void giveHeroBonus(GiveBonus * bonus) override {};
|
||||
void setMovePoints(SetMovePoints * smp) override {};
|
||||
void setMovePoints(ObjectInstanceID hid, int val, bool absolute) override {};
|
||||
void setManaPoints(ObjectInstanceID hid, int val) override {};
|
||||
void giveHero(ObjectInstanceID id, PlayerColor player, ObjectInstanceID boatId = ObjectInstanceID()) override {};
|
||||
void changeObjPos(ObjectInstanceID objid, int3 newPos, const PlayerColor & initiator) override {};
|
||||
void sendAndApply(CPackForClient & pack) override {};
|
||||
void heroExchange(ObjectInstanceID hero1, ObjectInstanceID hero2) override {};
|
||||
void castSpell(const spells::Caster * caster, SpellID spellID, const int3 &pos) override {};
|
||||
|
||||
void changeFogOfWar(int3 center, ui32 radius, PlayerColor player, ETileVisibility mode) override {}
|
||||
void changeFogOfWar(const std::unordered_set<int3> & tiles, PlayerColor player, ETileVisibility mode) override {}
|
||||
|
||||
void setObjPropertyValue(ObjectInstanceID objid, ObjProperty prop, int32_t value) override {};
|
||||
void setObjPropertyID(ObjectInstanceID objid, ObjProperty prop, ObjPropertyID identifier) override {};
|
||||
void setRewardableObjectConfiguration(ObjectInstanceID objid, const Rewardable::Configuration & configuration) override {};
|
||||
void setRewardableObjectConfiguration(ObjectInstanceID townInstanceID, BuildingID buildingID, const Rewardable::Configuration & configuration) override{};
|
||||
|
||||
void showInfoDialog(InfoWindow * iw) override {};
|
||||
void removeGUI() const;
|
||||
|
||||
vstd::RNG & getRandomGenerator() override;
|
||||
|
||||
#if SCRIPTING_ENABLED
|
||||
scripting::Pool * getGlobalContextPool() const override;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user