ObjectConfig.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * ObjectInfo.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 "../mapObjects/CompoundMapObjectID.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class DLL_LINKAGE ObjectConfig
  14. {
  15. #ifdef ENABLE_TEMPLATE_EDITOR
  16. friend class ObjectSelector;
  17. #endif
  18. public:
  19. enum class EObjectCategory
  20. {
  21. OTHER = -2,
  22. ALL = -1,
  23. NONE = 0,
  24. CREATURE_BANK = 1,
  25. BONUS,
  26. DWELLING,
  27. RESOURCE,
  28. RESOURCE_GENERATOR,
  29. SPELL_SCROLL,
  30. RANDOM_ARTIFACT,
  31. PANDORAS_BOX,
  32. QUEST_ARTIFACT,
  33. SEER_HUT
  34. };
  35. void addBannedObject(const CompoundMapObjectID & objid);
  36. void addCustomObject(const ObjectInfo & object);
  37. void addRequiredObject(const CompoundMapObjectID & objid, ui16 count, std::optional<ui32> guardLevel = std::nullopt);
  38. void addRequiredObject(const CompoundMapObjectID & objid, std::pair<ui16, std::optional<ui32>> info);
  39. void clearBannedObjects();
  40. void clearCustomObjects();
  41. void clearRequiredObjects();
  42. const std::vector<CompoundMapObjectID> & getBannedObjects() const;
  43. const std::vector<EObjectCategory> & getBannedObjectCategories() const;
  44. const std::vector<ObjectInfo> & getConfiguredObjects() const;
  45. std::map<CompoundMapObjectID, std::pair<ui16, std::optional<ui32>>> getRequiredObjects() const;
  46. void serializeJson(JsonSerializeFormat & handler);
  47. private:
  48. // TODO: Add convenience method for banning objects by name
  49. std::vector<CompoundMapObjectID> bannedObjects;
  50. std::vector<EObjectCategory> bannedObjectCategories;
  51. // TODO: In what format should I store custom objects?
  52. // Need to convert map serialization format to ObjectInfo
  53. std::vector<ObjectInfo> customObjects;
  54. std::map<CompoundMapObjectID, std::pair<ui16, std::optional<ui32>>> requiredObjects; // obligatory, potentially guarded objects to spawn in this zone
  55. };
  56. VCMI_LIB_NAMESPACE_END