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 "../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. template <typename Handler> void serialize(Handler &h, const int version)
  34. {
  35. h & configuration;
  36. }
  37. };
  38. }
  39. VCMI_LIB_NAMESPACE_END