$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "pathfinder.h"
#include "actions.h"
#include "map.h"
#include "unittype.h"
#include "unit.h"
Functions | |
pathfinder.cpp - The path finder routines. | |
void | InitAStar (int mapWidth, int mapHeight) |
Init the a* data structures. | |
void | FreeAStar () |
free the a* data structures | |
int | AStarFindPath (const Vec2i &startPos, const Vec2i &goalPos, int gw, int gh, int tilesizex, int tilesizey, int minrange, int maxrange, char *path, int pathlen, const CUnit &unit) |
Find and a* path for a unit. | |
void | InitPathfinder () |
Init the pathfinder. | |
void | FreePathfinder () |
Free the pathfinder. | |
int | PlaceReachable (const CUnit &src, const Vec2i &goalPos, int w, int h, int minrange, int range) |
int | UnitReachable (const CUnit &src, const CUnit &dst, int range) |
Return distance to unit. | |
static int | NewPath (PathFinderInput &input, PathFinderOutput &output) |
int | NextPathElement (CUnit &unit, short int *pxd, short int *pyd) |
Returns the next element of the path. |
int AStarFindPath | ( | const Vec2i & | startPos, | |
const Vec2i & | goalPos, | |||
int | gw, | |||
int | gh, | |||
int | tilesizex, | |||
int | tilesizey, | |||
int | minrange, | |||
int | maxrange, | |||
char * | path, | |||
int | pathlen, | |||
const CUnit & | unit | |||
) |
Find and a* path for a unit.
void FreeAStar | ( | ) |
free the a* data structures
Free A* data structure
void FreePathfinder | ( | ) |
Free the pathfinder.
Free the pathfinder
void InitAStar | ( | int | mapWidth, | |
int | mapHeight | |||
) |
Init the a* data structures.
Init A* data structures
void InitPathfinder | ( | ) |
Init the pathfinder.
Init the pathfinder
static int NewPath | ( | PathFinderInput & | input, | |
PathFinderOutput & | output | |||
) | [static] |
Find new path.
The destination could be a unit or a field. Range gives how far we must reach the goal.
unit | Path for this unit. |
int NextPathElement | ( | CUnit & | unit, | |
short int * | pxd, | |||
short int * | pyd | |||
) |
Returns the next element of the path.
Returns the next element of a path.
unit | Unit that wants the path element. | |
pxd | Pointer for the x direction. | |
pyd | Pointer for the y direction. |
int PlaceReachable | ( | const CUnit & | src, | |
const Vec2i & | goalPos, | |||
int | w, | |||
int | h, | |||
int | minrange, | |||
int | range | |||
) |
Can the unit 'src' reach the place goalPos.
src | Unit for the path. | |
goalPos | Map tile position. | |
w | Width of Goal | |
h | Height of Goal | |
minrange | min range to the tile | |
range | Range to the tile. |
Return distance to unit.
Can the unit 'src' reach the unit 'dst'.
src | Unit for the path. | |
dst | Unit to be reached. | |
range | Range to unit. |