summaryrefslogtreecommitdiffhomepage
path: root/src/path-search.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-24 05:16:58 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-24 05:16:58 +0100
commitdb09342af865ac5df7d4c35f25115ed39fbd0ddd (patch)
tree06216a603a8d1629c690e8dd6ef0ce06eae965cd /src/path-search.hpp
parentee2f8ee5e5d4e97d7dcaaaf2d7753d1fb6deeadd (diff)
src: split bbox into its own header
Diffstat (limited to 'src/path-search.hpp')
-rw-r--r--src/path-search.hpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/path-search.hpp b/src/path-search.hpp
index 3a32dbff..c48b5532 100644
--- a/src/path-search.hpp
+++ b/src/path-search.hpp
@@ -2,13 +2,10 @@
#include "tile-constants.hpp"
#include "global-coords.hpp"
#include "object-id.hpp"
-#include "world.hpp"
+#include "collision.hpp"
#include "compat/function2.fwd.hpp"
#include "path-search-result.hpp"
-#include <concepts>
#include <array>
-#include <Magnum/Math/Vector2.h>
-#include <Magnum/DimensionTraits.h>
namespace floormat {
class world;
@@ -20,6 +17,7 @@ class chunk;
namespace floormat::detail_astar {
+template<typename T> struct bbox;
struct cache;
struct chunk_cache;
static constexpr int div_factor = 4;
@@ -36,24 +34,9 @@ enum class path_search_continue : bool { pass = false, blocked = true };
class path_search final
{
friend struct path_search_result;
+ template<typename T> using bbox = detail_astar::bbox<T>;
public:
- template<typename T>
- requires std::is_arithmetic_v<T>
- struct bbox
- {
- VectorTypeFor<2, T> min, max;
-
- template<typename U>
- requires std::is_arithmetic_v<U>
- explicit constexpr operator bbox<U>() const {
- using Vec = VectorTypeFor<2, U>;
- return bbox<U>{ Vec(min), Vec(max) };
- }
-
- constexpr bool operator==(const bbox<T>&) const = default;
- };
-
using pred = fu2::function_view<path_search_continue(collision_data) const>;
static const pred& never_continue() noexcept;
@@ -68,6 +51,4 @@ public:
static bool is_passable(world& w, struct detail_astar::cache& cache, chunk_coords_ ch0, const bbox<float>& bb, object_id own_id, const pred& p = never_continue());
};
-
-
} // namespace floormat