IGameEventsReceiver.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * IGameEventsReceiver.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../constants/EntityIdentifiers.h"
  12. #include "../int3.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. struct ArtifactLocation;
  15. struct Bonus;
  16. struct Component;
  17. struct CPackForServer;
  18. struct PackageApplied;
  19. struct SetObjectProperty;
  20. struct TryMoveHero;
  21. class CArmedInstance;
  22. class CGBlackMarket;
  23. class CGDwelling;
  24. class CGHeroInstance;
  25. class CGObjectInstance;
  26. class CGTownInstance;
  27. class EVictoryLossCheckResult;
  28. class IShipyard;
  29. class IMarket;
  30. using FowTilesType = std::set<int3>;
  31. enum class EInfoWindowMode : uint8_t;
  32. class DLL_LINKAGE IGameEventsReceiver
  33. {
  34. public:
  35. virtual void buildChanged(const CGTownInstance *town, BuildingID buildingID, int what){}; //what: 1 - built, 2 - demolished
  36. virtual void battleResultsApplied(){}; //called when all effects of last battle are applied
  37. virtual void garrisonsChanged(ObjectInstanceID id1, ObjectInstanceID id2){};
  38. //artifacts operations
  39. virtual void artifactPut(const ArtifactLocation &al){};
  40. virtual void artifactRemoved(const ArtifactLocation &al){};
  41. virtual void artifactAssembled(const ArtifactLocation &al){};
  42. virtual void artifactDisassembled(const ArtifactLocation &al){};
  43. virtual void artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst){};
  44. virtual void bulkArtMovementStart(size_t totalNumOfArts, size_t possibleAssemblyNumOfArts) {};
  45. virtual void askToAssembleArtifact(const ArtifactLocation & dst) {};
  46. virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start){};
  47. virtual void heroCreated(const CGHeroInstance*){};
  48. virtual void heroInGarrisonChange(const CGTownInstance *town){};
  49. virtual void heroMoved(const TryMoveHero & details, bool verbose = true){};
  50. virtual void heroExperienceChanged(const CGHeroInstance * hero, si64 val){};
  51. virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, PrimarySkill which, si64 val){};
  52. virtual void heroSecondarySkillChanged(const CGHeroInstance * hero, int which, int val){};
  53. virtual void heroManaPointsChanged(const CGHeroInstance * hero){} //not called at the beginning of turn and after spell casts
  54. virtual void heroMovePointsChanged(const CGHeroInstance * hero){} //not called at the beginning of turn and after movement
  55. virtual void heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town){};
  56. virtual void receivedResource(){};
  57. virtual void showInfoDialog(EInfoWindowMode type, const std::string & text, const std::vector<Component> & components, int soundID){};
  58. virtual void showRecruitmentDialog(const CGDwelling *dwelling, const CArmedInstance *dst, int level, QueryID queryID){}
  59. virtual void showShipyardDialog(const IShipyard *obj){} //obj may be town or shipyard; state: 0 - can build, 1 - lack of resources, 2 - dest tile is blocked, 3 - no water
  60. virtual void showPuzzleMap(){};
  61. virtual void viewWorldMap(){};
  62. virtual void showMarketWindow(const IMarket * market, const CGHeroInstance * visitor, QueryID queryID){};
  63. virtual void showUniversityWindow(const IMarket *market, const CGHeroInstance *visitor, QueryID queryID){};
  64. virtual void showHillFortWindow(const CGObjectInstance *object, const CGHeroInstance *visitor){};
  65. virtual void showThievesGuildWindow (const CGObjectInstance * obj){};
  66. virtual void showTavernWindow(const CGObjectInstance * object, const CGHeroInstance * visitor, QueryID queryID) {};
  67. virtual void showQuestLog(){};
  68. virtual void advmapSpellCast(const CGHeroInstance * caster, SpellID spellID){}; //called when a hero casts a spell
  69. virtual void tileHidden(const FowTilesType &pos){};
  70. virtual void tileRevealed(const FowTilesType &pos){};
  71. virtual void newObject(const CGObjectInstance * obj){}; //eg. ship built in shipyard
  72. virtual void availableArtifactsChanged(const CGBlackMarket *bm = nullptr){}; //bm may be nullptr, then artifacts are changed in the global pool (used by merchants in towns)
  73. virtual void centerView (int3 pos, int focusTime){};
  74. virtual void availableCreaturesChanged(const CGDwelling *town){};
  75. virtual void heroBonusChanged(const CGHeroInstance *hero, const Bonus &bonus, bool gain){};//if gain hero received bonus, else he lost it
  76. virtual void playerBonusChanged(const Bonus &bonus, bool gain){};//if gain hero received bonus, else he lost it
  77. virtual void requestSent(const CPackForServer *pack, int requestID){};
  78. virtual void requestRealized(PackageApplied *pa){};
  79. virtual void beforeObjectPropertyChanged(const SetObjectProperty * sop){}; //eg. mine has been flagged
  80. virtual void objectPropertyChanged(const SetObjectProperty * sop){}; //eg. mine has been flagged
  81. virtual void objectRemoved(const CGObjectInstance *obj, const PlayerColor & initiator){}; //eg. collected resource, picked artifact, beaten hero
  82. virtual void objectRemovedAfter(){}; //eg. collected resource, picked artifact, beaten hero
  83. virtual void playerBlocked(int reason, bool start){}; //reason: 0 - upcoming battle
  84. virtual void gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult) {}; //player lost or won the game
  85. virtual void playerStartsTurn(PlayerColor player){};
  86. virtual void playerEndsTurn(PlayerColor player){};
  87. //TODO shouldn't be moved down the tree?
  88. virtual void heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID queryID){};
  89. };
  90. VCMI_LIB_NAMESPACE_END