BattleFieldHandler.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/BattleHexArray.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. BattleHexArray 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 getModScope() const override;
  50. std::string getNameTextID() const override;
  51. std::string getNameTranslated() const override;
  52. void registerIcons(const IconRegistar & cb) const override;
  53. BattleField getId() const override;
  54. };
  55. class DLL_LINKAGE BattleFieldService : public EntityServiceT<BattleField, BattleFieldInfo>
  56. {
  57. public:
  58. };
  59. class BattleFieldHandler : public CHandlerBase<BattleField, BattleFieldInfo, BattleFieldInfo, BattleFieldService>
  60. {
  61. public:
  62. std::shared_ptr<BattleFieldInfo> loadFromJson(
  63. const std::string & scope,
  64. const JsonNode & json,
  65. const std::string & identifier,
  66. size_t index) override;
  67. const std::vector<std::string> & getTypeNames() const override;
  68. std::vector<JsonNode> loadLegacyData() override;
  69. };
  70. VCMI_LIB_NAMESPACE_END