Interface.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Interface.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 "../CCreatureSet.h"
  12. #include "../ResourceSet.h"
  13. #include "../spells/ExternalCaster.h"
  14. #include "Configuration.h"
  15. VCMI_LIB_NAMESPACE_BEGIN
  16. class IGameCallback;
  17. namespace Rewardable
  18. {
  19. class DLL_LINKAGE Interface
  20. {
  21. private:
  22. /// caster to cast adveture spells, no serialize
  23. mutable spells::ExternalCaster caster;
  24. protected:
  25. /// filters list of visit info and returns rewards that can be granted to current hero
  26. std::vector<ui32> getAvailableRewards(const CGHeroInstance * hero, Rewardable::EEventType event) const;
  27. /// function that must be called if hero got level-up during grantReward call
  28. virtual void grantRewardAfterLevelup(IGameCallback * cb, const Rewardable::VisitInfo & reward, const CArmedInstance * army, const CGHeroInstance * hero) const;
  29. /// grants reward to hero
  30. virtual void grantRewardBeforeLevelup(IGameCallback * cb, const Rewardable::VisitInfo & reward, const CGHeroInstance * hero) const;
  31. public:
  32. Rewardable::Configuration configuration;
  33. void serializeJson(JsonSerializeFormat & handler);
  34. template <typename Handler> void serialize(Handler &h, const int version)
  35. {
  36. h & configuration;
  37. }
  38. };
  39. }
  40. VCMI_LIB_NAMESPACE_END