Atrinik Server  4.0
Data Structures | Macros | Typedefs | Enumerations | Functions
pathfinder.h File Reference
#include <toolkit/toolkit.h>

Go to the source code of this file.

Data Structures

struct  path_node
 
struct  path_visualizer
 
struct  path_visualization
 

Macros

#define PATH_NODE_EXIT   0x01
 
#define PATHFINDING_CHECK_ID(m, id)
 
#define PATHFINDING_VISUALIZER_APPEND(visualizer, _m, _x, _y, _closed, _node)
 
#define PATHFINDING_SET_CLOSED(m, x, y, id, visualizer)
 
#define PATHFINDING_QUERY_CLOSED(m, x, y, id)
 
#define PATHFINDING_NODE_SET(m, x, y, id, node, visualizer)
 
#define PATHFINDING_NODE_GET(m, x, y, id)
 
#define FLAG_WP_PATH_REQUESTED   FLAG_PARALYZED
 
#define LEFTOVER_CPU_FOR_PATHFINDING
 

Typedefs

typedef enum path_algo path_algo_t
 
typedef struct path_node path_node_t
 
typedef struct path_visualizer path_visualizer_t
 
typedef struct path_visualization path_visualization_t
 

Enumerations

enum  path_algo { PATH_ALGO_BFS, PATH_ALGO_ASTAR, PATH_ALGO_DIJKSTRA, PATH_ALGO_NUM }
 

Functions

 TOOLKIT_FUNCS_DECLARE (pathfinder)
 

Detailed Description

Pathfinding header file

Definition in file pathfinder.h.

Macro Definition Documentation

#define FLAG_WP_PATH_REQUESTED   FLAG_PARALYZED

Pseudo-flag used to mark waypoints as "has requested path".

Reuses a non-saved flag.

Definition at line 150 of file pathfinder.h.

#define LEFTOVER_CPU_FOR_PATHFINDING

Enable more intelligent use of CPU time for path finding?

Definition at line 158 of file pathfinder.h.

#define PATHFINDING_CHECK_ID (   m,
  id 
)
Value:
if ((m)->pathfinding_id != (id)) { \
(m)->pathfinding_id = (id); \
memset((m)->bitmap, 0, ((MAP_WIDTH(m) + 31) / 32) * MAP_HEIGHT(m) * \
sizeof(*(m)->bitmap)); \
memset((m)->path_nodes, 0, MAP_WIDTH(m) * MAP_HEIGHT(m) * \
sizeof(*(m)->path_nodes)); \
}
#define MAP_WIDTH(m)
Definition: map.h:120
#define MAP_HEIGHT(m)
Definition: map.h:122

Definition at line 99 of file pathfinder.h.

#define PATHFINDING_NODE_GET (   m,
  x,
  y,
  id 
)
Value:
((m)->pathfinding_id != (id) ? NULL : (m)->path_nodes[(x) + \
MAP_WIDTH(m) * (y)])
#define MAP_WIDTH(m)
Definition: map.h:120

Definition at line 141 of file pathfinder.h.

#define PATHFINDING_NODE_SET (   m,
  x,
  y,
  id,
  node,
  visualizer 
)
Value:
{ \
PATHFINDING_CHECK_ID(m, id); \
PATHFINDING_VISUALIZER_APPEND(visualizer, m, x, y, false, node); \
(m)->path_nodes[(x) + MAP_WIDTH(m) * (y)] = node; \
}
#define MAP_WIDTH(m)
Definition: map.h:120

Definition at line 134 of file pathfinder.h.

#define PATHFINDING_QUERY_CLOSED (   m,
  x,
  y,
  id 
)
Value:
((m)->pathfinding_id == (id) && ((m)->bitmap[(x) / 32 + \
((MAP_WIDTH(m) + 31) / 32) * (y)] & (1U << ((x) % 32))))
#define MAP_WIDTH(m)
Definition: map.h:120

Definition at line 130 of file pathfinder.h.

#define PATHFINDING_SET_CLOSED (   m,
  x,
  y,
  id,
  visualizer 
)
Value:
{ \
PATHFINDING_CHECK_ID(m, id); \
PATHFINDING_VISUALIZER_APPEND(visualizer, m, x, y, true, NULL); \
(m)->bitmap[(x) / 32 + ((MAP_WIDTH(m) + 31) / 32) * (y)] |= \
(1U << ((x) % 32)); \
}
#define MAP_WIDTH(m)
Definition: map.h:120

Definition at line 122 of file pathfinder.h.

#define PATHFINDING_VISUALIZER_APPEND (   visualizer,
  _m,
  _x,
  _y,
  _closed,
  _node 
)
Value:
if (visualizer != NULL) { \
\
__tmp = ecalloc(1, sizeof(*__tmp)); \
__tmp->map = (_m); \
__tmp->x = (_x); \
__tmp->y = (_y); \
__tmp->closed = (_closed); \
__tmp->node = (_node); \
__tmp->id = node_id++; \
DL_APPEND(*visualizer, __tmp); \
}
struct path_visualizer path_visualizer_t

Definition at line 108 of file pathfinder.h.

Typedef Documentation

typedef struct path_node path_node_t

Path node.

Contains all the maps that were visited in a hash table, for the purposes of path visualization.

Used for visualization of path nodes; represents one node.

Enumeration Type Documentation

enum path_algo
Enumerator
PATH_ALGO_BFS 

BFS.

PATH_ALGO_ASTAR 

A*.

PATH_ALGO_DIJKSTRA 

Dijkstra.

PATH_ALGO_NUM 

Total number of algorithms.

Definition at line 45 of file pathfinder.h.