ArtifactLocation.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. ArtifactLocation(const ObjectInstanceID id, const std::optional<SlotID> creatureSlot, const ArtifactPosition & slot)
  37. : artHolder(id)
  38. , slot(slot)
  39. , creature(creatureSlot)
  40. {
  41. }
  42. template <typename Handler> void serialize(Handler & h)
  43. {
  44. h & artHolder;
  45. h & slot;
  46. h & creature;
  47. }
  48. };
  49. struct MoveArtifactInfo
  50. {
  51. ArtifactPosition srcPos;
  52. ArtifactPosition dstPos;
  53. bool askAssemble;
  54. MoveArtifactInfo()
  55. : srcPos(ArtifactPosition::PRE_FIRST)
  56. , dstPos(ArtifactPosition::PRE_FIRST)
  57. , askAssemble(false)
  58. {
  59. }
  60. MoveArtifactInfo(const ArtifactPosition & srcPos, const ArtifactPosition & dstPos, bool askAssemble = false)
  61. : srcPos(srcPos)
  62. , dstPos(dstPos)
  63. , askAssemble(askAssemble)
  64. {
  65. }
  66. template <typename Handler> void serialize(Handler & h)
  67. {
  68. h & srcPos;
  69. h & dstPos;
  70. h & askAssemble;
  71. }
  72. };
  73. enum class DischargeArtifactCondition
  74. {
  75. SPELLCAST,
  76. BATTLE,
  77. BUILDING // not implemented
  78. };
  79. VCMI_LIB_NAMESPACE_END