RiverHandler.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. std::string getModScope() const override;
  35. void registerIcons(const IconRegistar & cb) const override {}
  36. RiverId getId() const override { return id;}
  37. void updateFrom(const JsonNode & data) {};
  38. std::string getNameTextID() const override;
  39. std::string getNameTranslated() const override;
  40. AnimationPath tilesFilename;
  41. std::string shortIdentifier;
  42. std::string deltaName;
  43. std::vector<RiverPaletteAnimation> paletteAnimation;
  44. RiverType();
  45. };
  46. class DLL_LINKAGE RiverTypeService : public EntityServiceT<RiverId, RiverType>
  47. {
  48. public:
  49. };
  50. class DLL_LINKAGE RiverTypeHandler : public CHandlerBase<RiverId, RiverType, RiverType, RiverTypeService>
  51. {
  52. public:
  53. std::shared_ptr<RiverType> loadFromJson(
  54. const std::string & scope,
  55. const JsonNode & json,
  56. const std::string & identifier,
  57. size_t index) override;
  58. RiverTypeHandler();
  59. const std::vector<std::string> & getTypeNames() const override;
  60. std::vector<JsonNode> loadLegacyData() override;
  61. };
  62. VCMI_LIB_NAMESPACE_END