BattleFieldHandler.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. BattleFieldInfo()
  33. : BattleFieldInfo(BattleField::NONE, "")
  34. {
  35. }
  36. BattleFieldInfo(BattleField battlefield, std::string identifier):
  37. isSpecial(false),
  38. battlefield(battlefield),
  39. identifier(identifier),
  40. iconIndex(battlefield.getNum()),
  41. name(identifier)
  42. {
  43. }
  44. int32_t getIndex() const override;
  45. int32_t getIconIndex() const override;
  46. std::string getJsonKey() const override;
  47. std::string getNameTextID() const override;
  48. std::string getNameTranslated() const override;
  49. void registerIcons(const IconRegistar & cb) const override;
  50. BattleField getId() const override;
  51. };
  52. class DLL_LINKAGE BattleFieldService : public EntityServiceT<BattleField, BattleFieldInfo>
  53. {
  54. public:
  55. };
  56. class BattleFieldHandler : public CHandlerBase<BattleField, BattleFieldInfo, BattleFieldInfo, BattleFieldService>
  57. {
  58. public:
  59. virtual BattleFieldInfo * loadFromJson(
  60. const std::string & scope,
  61. const JsonNode & json,
  62. const std::string & identifier,
  63. size_t index) override;
  64. virtual const std::vector<std::string> & getTypeNames() const override;
  65. virtual std::vector<JsonNode> loadLegacyData() override;
  66. };
  67. VCMI_LIB_NAMESPACE_END