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