RmgPath.h 1.5 KB

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