You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
/** |
|
* @file path.h |
|
* |
|
* Interface of the path finding algorithms. |
|
*/ |
|
#pragma once |
|
|
|
#include <functional> |
|
|
|
#include <SDL.h> |
|
|
|
#include "engine/direction.hpp" |
|
#include "engine/point.hpp" |
|
|
|
namespace devilution { |
|
|
|
#define MAX_PATH_LENGTH 25 |
|
|
|
struct PATHNODE { |
|
uint8_t f; |
|
uint8_t h; |
|
uint8_t g; |
|
Point position; |
|
struct PATHNODE *Parent; |
|
struct PATHNODE *Child[8]; |
|
struct PATHNODE *NextNode; |
|
}; |
|
|
|
bool IsTileNotSolid(Point position); |
|
bool IsTileSolid(Point position); |
|
bool IsTileWalkable(Point position, bool ignoreDoors = false); |
|
int FindPath(const std::function<bool(Point)> &posOk, int sx, int sy, int dx, int dy, int8_t path[MAX_PATH_LENGTH]); |
|
int path_get_h_cost(int sx, int sy, int dx, int dy); |
|
PATHNODE *GetNextPath(); |
|
bool path_solid_pieces(PATHNODE *pPath, int dx, int dy); |
|
bool path_get_path(const std::function<bool(Point)> &posOk, PATHNODE *pPath, int x, int y); |
|
bool path_parent_path(PATHNODE *pPath, int dx, int dy, int sx, int sy); |
|
PATHNODE *path_get_node1(int dx, int dy); |
|
PATHNODE *path_get_node2(int dx, int dy); |
|
void path_next_node(PATHNODE *pPath); |
|
void path_set_coords(PATHNODE *pPath); |
|
void path_push_active_step(PATHNODE *pPath); |
|
PATHNODE *path_pop_active_step(); |
|
PATHNODE *path_new_step(); |
|
|
|
/* rdata */ |
|
|
|
extern const Displacement PathDirs[8]; |
|
|
|
} // namespace devilution
|
|
|