RmgPath.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * RmgPath.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 "../GameConstants.h"
  12. #include "../int3.h"
  13. #include "RmgArea.h"
  14. namespace rmg
  15. {
  16. class Path
  17. {
  18. public:
  19. const static std::function<float(const int3 &, const int3 &)> DEFAULT_MOVEMENT_FUNCTION;
  20. Path(const Area & area);
  21. Path(const Area & area, const int3 & src);
  22. Path(const Path & path);
  23. Path & operator= (const Path & path);
  24. bool valid() const;
  25. Path search(const Tileset & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
  26. Path search(const int3 & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
  27. Path search(const Area & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
  28. Path search(const Path & dst, bool straight, std::function<float(const int3 &, const int3 &)> moveCostFunction = DEFAULT_MOVEMENT_FUNCTION) const;
  29. void connect(const Path & path);
  30. void connect(const int3 & path); //TODO: force connection?
  31. void connect(const Area & path); //TODO: force connection?
  32. void connect(const Tileset & path); //TODO: force connection?
  33. const Area & getPathArea() const;
  34. static Path invalid();
  35. private:
  36. const Area * dArea = nullptr;
  37. Area dPath;
  38. };
  39. }