MapLayerHandler.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * MapLayerHandler.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. class DLL_LINKAGE MapLayerType : public EntityT<MapLayerId>
  18. {
  19. friend class MapLayerTypeHandler;
  20. std::string identifier;
  21. std::string modScope;
  22. MapLayerId id;
  23. public:
  24. int32_t getIndex() const override { return id.getNum(); }
  25. int32_t getIconIndex() const override { return 0; }
  26. std::string getJsonKey() const override;
  27. std::string getModScope() const override;
  28. void registerIcons(const IconRegistar & cb) const override {}
  29. MapLayerId getId() const override { return id;}
  30. void updateFrom(const JsonNode & data) {};
  31. std::string getNameTextID() const override;
  32. std::string getNameTranslated() const override;
  33. MapLayerType();
  34. };
  35. class DLL_LINKAGE MapLayerTypeService : public EntityServiceT<MapLayerId, MapLayerType>
  36. {
  37. };
  38. class DLL_LINKAGE MapLayerTypeHandler : public CHandlerBase<MapLayerId, MapLayerType, MapLayerType, MapLayerTypeService>
  39. {
  40. public:
  41. std::shared_ptr<MapLayerType> loadFromJson(
  42. const std::string & scope,
  43. const JsonNode & json,
  44. const std::string & identifier,
  45. size_t index) override;
  46. MapLayerTypeHandler();
  47. const std::vector<std::string> & getTypeNames() const override;
  48. std::vector<JsonNode> loadLegacyData() override;
  49. };
  50. VCMI_LIB_NAMESPACE_END