ArtifactLocation.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * ArtifactLocation.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 "../constants/EntityIdentifiers.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct ArtifactLocation
  14. {
  15. ObjectInstanceID artHolder;
  16. ArtifactPosition slot;
  17. std::optional<SlotID> creature;
  18. ArtifactLocation()
  19. : artHolder(ObjectInstanceID::NONE)
  20. , slot(ArtifactPosition::PRE_FIRST)
  21. , creature(std::nullopt)
  22. {
  23. }
  24. ArtifactLocation(const ObjectInstanceID id, const ArtifactPosition & slot = ArtifactPosition::PRE_FIRST)
  25. : artHolder(id)
  26. , slot(slot)
  27. , creature(std::nullopt)
  28. {
  29. }
  30. ArtifactLocation(const ObjectInstanceID id, const std::optional<SlotID> creatureSlot)
  31. : artHolder(id)
  32. , slot(ArtifactPosition::PRE_FIRST)
  33. , creature(creatureSlot)
  34. {
  35. }
  36. template <typename Handler> void serialize(Handler & h, const int version)
  37. {
  38. h & artHolder;
  39. h & slot;
  40. h & creature;
  41. }
  42. };
  43. VCMI_LIB_NAMESPACE_END