BattleFieldHandler.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * BattleFieldHandler.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 "bonuses/Bonus.h"
  14. #include "GameConstants.h"
  15. #include "IHandlerBase.h"
  16. #include "battle/BattleHex.h"
  17. #include "filesystem/ResourcePath.h"
  18. VCMI_LIB_NAMESPACE_BEGIN
  19. class BattleFieldInfo : public EntityT<BattleField>
  20. {
  21. public:
  22. BattleField battlefield;
  23. std::vector<std::shared_ptr<Bonus>> bonuses;
  24. bool isSpecial;
  25. ImagePath graphics;
  26. std::string name;
  27. std::string modScope;
  28. std::string identifier;
  29. std::string icon;
  30. si32 iconIndex;
  31. std::vector<BattleHex> impassableHexes;
  32. AudioPath openingSoundFilename;
  33. AudioPath musicFilename;
  34. BattleFieldInfo()
  35. : BattleFieldInfo(BattleField::NONE, "")
  36. {
  37. }
  38. BattleFieldInfo(BattleField battlefield, std::string identifier):
  39. isSpecial(false),
  40. battlefield(battlefield),
  41. identifier(identifier),
  42. iconIndex(battlefield.getNum()),
  43. name(identifier)
  44. {
  45. }
  46. int32_t getIndex() const override;
  47. int32_t getIconIndex() const override;
  48. std::string getJsonKey() const override;
  49. std::string getNameTextID() const override;
  50. std::string getNameTranslated() const override;
  51. void registerIcons(const IconRegistar & cb) const override;
  52. BattleField getId() const override;
  53. };
  54. class DLL_LINKAGE BattleFieldService : public EntityServiceT<BattleField, BattleFieldInfo>
  55. {
  56. public:
  57. };
  58. class BattleFieldHandler : public CHandlerBase<BattleField, BattleFieldInfo, BattleFieldInfo, BattleFieldService>
  59. {
  60. public:
  61. std::shared_ptr<BattleFieldInfo> loadFromJson(
  62. const std::string & scope,
  63. const JsonNode & json,
  64. const std::string & identifier,
  65. size_t index) override;
  66. const std::vector<std::string> & getTypeNames() const override;
  67. std::vector<JsonNode> loadLegacyData() override;
  68. };
  69. VCMI_LIB_NAMESPACE_END