RoadHandler.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. class DLL_LINKAGE RoadType : public EntityT<RoadId>
  18. {
  19. friend class RoadTypeHandler;
  20. std::string identifier;
  21. std::string modScope;
  22. RoadId 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. RoadId getId() const override { return id;}
  30. void updateFrom(const JsonNode & data) {};
  31. std::string getNameTextID() const override;
  32. std::string getNameTranslated() const override;
  33. AnimationPath tilesFilename;
  34. std::string shortIdentifier;
  35. ui8 movementCost;
  36. RoadType();
  37. };
  38. class DLL_LINKAGE RoadTypeService : public EntityServiceT<RoadId, RoadType>
  39. {
  40. public:
  41. };
  42. class DLL_LINKAGE RoadTypeHandler : public CHandlerBase<RoadId, RoadType, RoadType, RoadTypeService>
  43. {
  44. public:
  45. std::shared_ptr<RoadType> loadFromJson(
  46. const std::string & scope,
  47. const JsonNode & json,
  48. const std::string & identifier,
  49. size_t index) override;
  50. RoadTypeHandler();
  51. const std::vector<std::string> & getTypeNames() const override;
  52. std::vector<JsonNode> loadLegacyData() override;
  53. };
  54. VCMI_LIB_NAMESPACE_END