2
0

StackLocation.h 901 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * StackLocation.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 "../ConstTransitivePtr.h"
  12. #include "../GameConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CArmedInstance;
  15. class CStackInstance;
  16. struct StackLocation
  17. {
  18. ConstTransitivePtr<CArmedInstance> army;
  19. SlotID slot;
  20. StackLocation() = default;
  21. StackLocation(const CArmedInstance * Army, const SlotID & Slot)
  22. : army(const_cast<CArmedInstance *>(Army)) //we are allowed here to const cast -> change will go through one of our packages... do not abuse!
  23. , slot(Slot)
  24. {
  25. }
  26. DLL_LINKAGE const CStackInstance * getStack();
  27. template <typename Handler> void serialize(Handler & h, const int version)
  28. {
  29. h & army;
  30. h & slot;
  31. }
  32. };
  33. VCMI_LIB_NAMESPACE_END