RandomMapInfo.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * RandomMapInfo.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. VCMI_LIB_NAMESPACE_BEGIN
  12. /// Structure that describes placement rules for this object in random map
  13. struct DLL_LINKAGE RandomMapInfo
  14. {
  15. /// How valuable this object is, 1k = worthless, 10k = Utopia-level
  16. ui32 value;
  17. /// How many of such objects can be placed on map, 0 = object can not be placed by RMG
  18. std::optional<ui32> mapLimit;
  19. /// How many of such objects can be placed in one zone, 0 = unplaceable
  20. ui32 zoneLimit;
  21. /// Rarity of object, 5 = extremely rare, 100 = common
  22. ui32 rarity;
  23. RandomMapInfo():
  24. value(0),
  25. zoneLimit(0),
  26. rarity(0)
  27. {}
  28. void setMapLimit(ui32 val) { mapLimit = val; }
  29. template <typename Handler> void serialize(Handler &h, const int version)
  30. {
  31. h & value;
  32. h & mapLimit;
  33. h & zoneLimit;
  34. h & rarity;
  35. }
  36. };
  37. VCMI_LIB_NAMESPACE_END