summaryrefslogtreecommitdiff
path: root/src/common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.hpp')
-rw-r--r--src/common.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp
index ced0b25..bbf83cf 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -5,6 +5,7 @@
#include <map>
#include <list>
#include <unordered_set>
+#include <stack>
#include <SFML/Graphics.hpp>
#include "math.hpp"
@@ -112,6 +113,25 @@ namespace world {
virtual void render_to(render::state_t *render) = 0;
};
+
+ typedef struct {
+ bool accessible;
+ float dist;
+ } path_node_t;
+
+ class path_finder_t {
+ public:
+ v2f_t src, dst;
+ path_node_t *nodes;
+ size_t width, height;
+ tile_index_t base;
+ std::stack<v2f_t> current_path, shortest_path;
+
+ ~path_finder_t();
+ void setup_nodes(v2f_t src_, v2f_t dst_);
+ void find_r(tile_index_t index, float dist);
+ void find(void);
+ };
}
namespace game {