RiverHandler.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * TerrainHandler.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 <vcmi/EntityService.h>
  12. #include <vcmi/Entity.h>
  13. #include "GameConstants.h"
  14. #include "IHandlerBase.h"
  15. #include "filesystem/ResourcePath.h"
  16. VCMI_LIB_NAMESPACE_BEGIN
  17. struct DLL_LINKAGE RiverPaletteAnimation
  18. {
  19. /// index of first color to cycle
  20. int32_t start;
  21. /// total numbers of colors to cycle
  22. int32_t length;
  23. };
  24. class DLL_LINKAGE RiverType : public EntityT<RiverId>
  25. {
  26. friend class RiverTypeHandler;
  27. std::string identifier;
  28. std::string modScope;
  29. RiverId id;
  30. public:
  31. int32_t getIndex() const override { return id.getNum(); }
  32. int32_t getIconIndex() const override { return 0; }
  33. std::string getJsonKey() const override;
  34. void registerIcons(const IconRegistar & cb) const override {}
  35. RiverId getId() const override { return id;}
  36. void updateFrom(const JsonNode & data) {};
  37. std::string getNameTextID() const override;
  38. std::string getNameTranslated() const override;
  39. AnimationPath tilesFilename;
  40. std::string shortIdentifier;
  41. std::string deltaName;
  42. std::vector<RiverPaletteAnimation> paletteAnimation;
  43. RiverType();
  44. };
  45. class DLL_LINKAGE RiverTypeService : public EntityServiceT<RiverId, RiverType>
  46. {
  47. public:
  48. };
  49. class DLL_LINKAGE RiverTypeHandler : public CHandlerBase<RiverId, RiverType, RiverType, RiverTypeService>
  50. {
  51. public:
  52. virtual RiverType * loadFromJson(
  53. const std::string & scope,
  54. const JsonNode & json,
  55. const std::string & identifier,
  56. size_t index) override;
  57. RiverTypeHandler();
  58. virtual const std::vector<std::string> & getTypeNames() const override;
  59. virtual std::vector<JsonNode> loadLegacyData() override;
  60. };
  61. VCMI_LIB_NAMESPACE_END