Destination.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Destination.cpp, 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. #include "StdInc.h"
  11. #include "Destination.h"
  12. #include "Unit.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. namespace battle
  15. {
  16. Destination::Destination()
  17. : unitValue(nullptr),
  18. hexValue(BattleHex::INVALID)
  19. {
  20. }
  21. Destination::~Destination() = default;
  22. Destination::Destination(const battle::Unit * destination)
  23. : unitValue(destination),
  24. hexValue(destination->getPosition())
  25. {
  26. }
  27. Destination::Destination(const BattleHex & destination)
  28. : unitValue(nullptr),
  29. hexValue(destination)
  30. {
  31. }
  32. Destination::Destination(const Unit * destination, const BattleHex & exactHex)
  33. : unitValue(destination),
  34. hexValue(exactHex)
  35. {
  36. }
  37. Destination::Destination(const Destination & other)
  38. : unitValue(other.unitValue),
  39. hexValue(other.hexValue)
  40. {
  41. }
  42. Destination & Destination::operator=(const Destination & other)
  43. {
  44. unitValue = other.unitValue;
  45. hexValue = other.hexValue;
  46. return *this;
  47. }
  48. }
  49. VCMI_LIB_NAMESPACE_END