Needed to rewrite the pathing to get this to work. I actually had been using a purposefully broken pathing algorithm from when I was making random maps.
This commit is contained in:
parent
c894f6e094
commit
e92fd2b6f3
10 changed files with 169 additions and 111 deletions
10
pathing.hpp
10
pathing.hpp
|
@ -7,7 +7,12 @@ using matrix::Matrix;
|
|||
|
||||
constexpr const int PATHING_TOWARD=1;
|
||||
constexpr const int PATHING_AWAY=-1;
|
||||
constexpr const int DIRECTION_MAX=8;
|
||||
|
||||
enum class PathingResult {
|
||||
FAIL=0,
|
||||
FOUND=1,
|
||||
CONTINUE=2
|
||||
};
|
||||
|
||||
class Pathing {
|
||||
public:
|
||||
|
@ -29,8 +34,7 @@ public:
|
|||
Matrix &paths() { return $paths; }
|
||||
Matrix &input() { return $input; }
|
||||
int distance(Point to) { return $paths[to.y][to.x];}
|
||||
bool random_walk(Point &out, bool random, int direction,
|
||||
size_t slice_count=4, size_t dist_size=4);
|
||||
PathingResult find_path(Point &out, int direction, bool diag);
|
||||
|
||||
bool INVARIANT();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue