summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-08 09:52:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-08 09:52:50 +0200
commit832641f2905532263f70b3ea9ecc4a9ca7373ed2 (patch)
treec85af0bcec318729fe2fe295b020efe0f387d3e8 /src
parentbfe9becfca9e789bf653c4bb8e92917acac04218 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/path-search-dijkstra.cpp11
-rw-r--r--src/path-search-result.hpp2
-rw-r--r--src/path-search.hpp14
3 files changed, 15 insertions, 12 deletions
diff --git a/src/path-search-dijkstra.cpp b/src/path-search-dijkstra.cpp
index bb29e402..5e7b7e79 100644
--- a/src/path-search-dijkstra.cpp
+++ b/src/path-search-dijkstra.cpp
@@ -73,6 +73,13 @@ constexpr bbox<T> bbox_from_pos(Math::Vector<2, T> pos, Vector2b offset, Vector2
return bb;
}
+bool add_start_node(std::vector<astar::visited>& nodes,
+ tsl::robin_map<point, uint32_t, astar::point_hash>& indexes,
+ std::vector<uint32_t>& Q)
+{
+
+}
+
} // namespace
bool astar::edge::operator==(const floormat::astar::edge& other) const = default;
@@ -148,10 +155,6 @@ path_search_result astar::Dijkstra(world& w, Vector2ub own_size, const object_id
Q.push_back(idx++);
std::push_heap(Q.begin(), Q.end(), heap_comparator);
}
- else
- {
-
- }
}
diff --git a/src/path-search-result.hpp b/src/path-search-result.hpp
index c7dde85e..90a4ba3d 100644
--- a/src/path-search-result.hpp
+++ b/src/path-search-result.hpp
@@ -9,7 +9,7 @@ namespace floormat {
struct path_search_result final
{
friend class path_search;
- friend class astar;
+ friend struct astar;
friend struct test_app;
struct pair { global_coords pos; Vector2 offset; };
diff --git a/src/path-search.hpp b/src/path-search.hpp
index a78d67c3..1ad1120d 100644
--- a/src/path-search.hpp
+++ b/src/path-search.hpp
@@ -54,7 +54,7 @@ public:
static bool is_passable(world& w, chunk_coords_ ch0, const bbox<float>& bb, object_id own_id, const pred& p = never_continue());
};
-class astar
+struct astar
{
struct visited
{
@@ -96,15 +96,9 @@ class astar
struct point_hash { size_t operator()(point pt) const; };
struct edge_hash { size_t operator()(const edge& e) const; };
- std::vector<visited> nodes;
- tsl::robin_map<edge, edge_status, edge_hash> edges;
- tsl::robin_map<point, uint32_t, point_hash> indexes;
- std::vector<uint32_t> Q;
-
using pred = path_search::pred;
template<typename T> using bbox = path_search::bbox<T>;
-public:
fm_DECLARE_DELETED_COPY_ASSIGNMENT(astar);
static edge make_edge(const point& a, const point& b)
@@ -151,6 +145,12 @@ public:
static constexpr auto div_factor = path_search::div_factor;
static constexpr auto initial_capacity = TILE_COUNT * 16 * div_factor*div_factor;
+
+private:
+ std::vector<visited> nodes;
+ tsl::robin_map<edge, edge_status, edge_hash> edges;
+ tsl::robin_map<point, uint32_t, point_hash> indexes;
+ std::vector<uint32_t> Q;
};
} // namespace floormat