BonusParams.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * BonusParams.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 "Bonus.h"
  12. #include "../GameConstants.h"
  13. #include "../JsonNode.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. struct DLL_LINKAGE BonusParams {
  16. bool isConverted;
  17. BonusType type = BonusType::NONE;
  18. std::optional<TBonusSubtype> subtype = std::nullopt;
  19. std::optional<std::string> subtypeStr = std::nullopt;
  20. std::optional<BonusValueType> valueType = std::nullopt;
  21. std::optional<si32> val = std::nullopt;
  22. std::optional<BonusSource> targetType = std::nullopt;
  23. BonusParams(bool isConverted = true) : isConverted(isConverted) {};
  24. BonusParams(std::string deprecatedTypeStr, std::string deprecatedSubtypeStr = "", int deprecatedSubtype = 0);
  25. const JsonNode & toJson();
  26. CSelector toSelector();
  27. private:
  28. JsonNode ret;
  29. bool jsonCreated = false;
  30. };
  31. extern DLL_LINKAGE const std::set<std::string> deprecatedBonusSet;
  32. VCMI_LIB_NAMESPACE_END