RiverHandler.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. VCMI_LIB_NAMESPACE_BEGIN
  16. class DLL_LINKAGE RiverType : public EntityT<RiverId>
  17. {
  18. friend class RiverTypeHandler;
  19. std::string identifier;
  20. std::string modScope;
  21. RiverId id;
  22. public:
  23. int32_t getIndex() const override { return id.getNum(); }
  24. int32_t getIconIndex() const override { return 0; }
  25. std::string getJsonKey() const override;
  26. void registerIcons(const IconRegistar & cb) const override {}
  27. RiverId getId() const override { return id;}
  28. void updateFrom(const JsonNode & data) {};
  29. std::string getNameTextID() const override;
  30. std::string getNameTranslated() const override;
  31. std::string tilesFilename;
  32. std::string shortIdentifier;
  33. std::string deltaName;
  34. RiverType();
  35. template <typename Handler> void serialize(Handler& h, const int version)
  36. {
  37. h & tilesFilename;
  38. h & identifier;
  39. h & modScope;
  40. h & deltaName;
  41. h & id;
  42. }
  43. };
  44. class DLL_LINKAGE RiverTypeService : public EntityServiceT<RiverId, RiverType>
  45. {
  46. public:
  47. };
  48. class DLL_LINKAGE RiverTypeHandler : public CHandlerBase<RiverId, RiverType, RiverType, RiverTypeService>
  49. {
  50. public:
  51. virtual RiverType * loadFromJson(
  52. const std::string & scope,
  53. const JsonNode & json,
  54. const std::string & identifier,
  55. size_t index) override;
  56. RiverTypeHandler();
  57. virtual const std::vector<std::string> & getTypeNames() const override;
  58. virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
  59. virtual std::vector<bool> getDefaultAllowed() const override;
  60. template <typename Handler> void serialize(Handler & h, const int version)
  61. {
  62. h & objects;
  63. }
  64. };
  65. VCMI_LIB_NAMESPACE_END