Destination.cpp 1.0 KB

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