From 832641f2905532263f70b3ea9ecc4a9ca7373ed2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 8 Oct 2023 09:52:50 +0200 Subject: a --- src/path-search-dijkstra.cpp | 11 +++++++---- src/path-search-result.hpp | 2 +- src/path-search.hpp | 14 +++++++------- 3 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') 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 bbox_from_pos(Math::Vector<2, T> pos, Vector2b offset, Vector2 return bb; } +bool add_start_node(std::vector& nodes, + tsl::robin_map& indexes, + std::vector& 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& 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 nodes; - tsl::robin_map edges; - tsl::robin_map indexes; - std::vector Q; - using pred = path_search::pred; template using bbox = path_search::bbox; -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 nodes; + tsl::robin_map edges; + tsl::robin_map indexes; + std::vector Q; }; } // namespace floormat -- cgit v1.2.3