Interface.h 1.3 KB

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