IGameEventsReceiver.h 5.6 KB

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