astar.h

lpc-astar-1.5.3/astar.h · 3.3 KB

From the archive lpc-astar-1.5.3.tar.gz

Download the archive   « Back to the archive contents

#ifndef _Astar_Included
#define _Astar_Included

// A* Path Data Structure
//
// Tracks a path as modeled by the A* algorithm.
//
// Usage: Variables containing A* path data structures can be found within
// pathfind data structures, as return values from immediately-successful
// pathfinding attempt, and as arguments to notification callbacks.  You
// would access the various data stored in it as path[Astar_Path_Loci],
// path[Astar_Path_Deltas], and so on.

// The list of loci making up the path.
#define Astar_Path_Loci                        0
// The deltas between loci in the path.  Each delta in the list represents
// the change necessary to move from the locus in the corresponding position
// in the list of loci to the next locus.
#define Astar_Path_Deltas                      1
// The path's distance from its target.
#define Astar_Path_Distance                    2
// The accumulated cost of the path.
#define Astar_Path_Cost                        3

#define Astar_Path_Fields                      4

// A* Pathfind Data Structure
//
// Tracks the information defining a pathfinding attempt.
//
// Usage: Most of the behavioral control rules used by the module receive a
// pathfind data structure as their argument.  You would access its data as
// pathfind[Astar_Pathfind_Active_Locus], pathfind[Astar_Pathfind_To], and
// so on.

// The starting locus of the pathfinding attempt
#define Astar_Pathfind_From                    0
// The target locus of the pathfinding attempt
#define Astar_Pathfind_To                      1
// The 'validate' argument astar_find_path() was called with, if any
#define Astar_Pathfind_Validate                2
// The 'callback' argument astar_find_path() was called with, if any
#define Astar_Pathfind_Callback                3
// An array of any extra arguments astar_find_path() was called with
#define Astar_Pathfind_Extra                   4
// A mapping of the loci visited
#define Astar_Pathfind_Visited                 5
// The time the pathfinding attempt started
#define Astar_Pathfind_Start_Time              6
// The number of times the pathfinding attempt has continued via call_out()
#define Astar_Pathfind_Iteration               7
// An array of the working path list for the pathfinding attempt
#define Astar_Pathfind_Paths                   8
// Set to the current path being worked with
#define Astar_Pathfind_Active_Path             9
// Set to the current locus being worked with
#define Astar_Pathfind_Active_Locus            10
// Set to the current delta being worked with
#define Astar_Pathfind_Active_Delta            11

#define Astar_Pathfind_Fields                  12

// A* Result Codes

// Result of astar_find_path() if pathfinding was moved to call_out(),
// either by the run limit being reached or by the neighbors rule needing
// ongoing processing, with a callback available
#define Astar_Result_Processing                1
// Result of astar_find_path() if pathfinding was found to be impossible
#define Astar_Result_Impossible                2
// Result of astar_find_path() if the run limit was encountered and
// no callback was available
#define Astar_Result_Terminated                3
// Result of astar_find_path() if the neighbors rule needed ongoing
// processing and no callback was available
#define Astar_Result_Cannot_Continue           4

#endif

Site Stats

Snippets: 1791
Codebases: 571