CFaction.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * CFaction.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/Faction.h>
  12. #include "../../constants/EntityIdentifiers.h"
  13. #include "../../constants/Enumerations.h"
  14. #include "../../filesystem/ResourcePath.h"
  15. VCMI_LIB_NAMESPACE_BEGIN
  16. class CTown;
  17. struct DLL_LINKAGE SPuzzleInfo
  18. {
  19. ui16 number; //type of puzzle
  20. si16 x, y; //position
  21. ui16 whenUncovered; //determines the sequence of discovering (the lesser it is the sooner puzzle will be discovered)
  22. ImagePath filename; //file with graphic of this puzzle
  23. };
  24. class DLL_LINKAGE CFaction : public Faction
  25. {
  26. friend class CTownHandler;
  27. friend class CBuilding;
  28. friend class CTown;
  29. std::string modScope;
  30. std::string identifier;
  31. FactionID index = FactionID::NEUTRAL;
  32. FactionID getFaction() const override; //This function should not be used
  33. public:
  34. TerrainId nativeTerrain;
  35. EAlignment alignment = EAlignment::NEUTRAL;
  36. bool preferUndergroundPlacement = false;
  37. bool special = false;
  38. /// Boat that will be used by town shipyard (if any)
  39. /// and for placing heroes directly on boat (in map editor, water prisons & taverns)
  40. BoatId boatType = BoatId::CASTLE;
  41. CTown * town = nullptr; //NOTE: can be null
  42. ImagePath creatureBg120;
  43. ImagePath creatureBg130;
  44. std::vector<SPuzzleInfo> puzzleMap;
  45. CFaction() = default;
  46. ~CFaction();
  47. int32_t getIndex() const override;
  48. int32_t getIconIndex() const override;
  49. std::string getJsonKey() const override;
  50. void registerIcons(const IconRegistar & cb) const override;
  51. FactionID getId() const override;
  52. std::string getNameTranslated() const override;
  53. std::string getNameTextID() const override;
  54. std::string getDescriptionTranslated() const;
  55. std::string getDescriptionTextID() const;
  56. bool hasTown() const override;
  57. TerrainId getNativeTerrain() const override;
  58. EAlignment getAlignment() const override;
  59. BoatId getBoatType() const override;
  60. void updateFrom(const JsonNode & data);
  61. void serializeJson(JsonSerializeFormat & handler);
  62. };
  63. VCMI_LIB_NAMESPACE_END