_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
Go to the source code of this file.
Classes | |
class | PathFinderInput |
class | PathFinderOutput |
class | PathFinderData |
class | TerrainTraversal |
pathfinder.h - The path finder headerfile. | |
#define | AstarDebugPrint(x) |
enum | _move_return_ { PF_FAILED = -3, PF_UNREACHABLE = -2, PF_REACHED = -1, PF_WAIT = 0, PF_MOVE = 1 } |
enum | VisitResult { VisitResult_Finished, VisitResult_DeadEnd, VisitResult_Ok, VisitResult_Cancel } |
int | AStarFixedUnitCrossingCost |
cost associated to move on a tile occupied by a fixed unit More... | |
int | AStarMovingUnitCrossingCost |
cost associated to move on a tile occupied by a moving unit More... | |
bool | AStarKnowUnseenTerrain |
Whether to have knowledge of terrain that we haven't visited yet. More... | |
int | AStarUnknownTerrainCost |
Cost of using a square we haven't seen before. More... | |
int | AStarMaxSearchIterations |
Maximum number of iterations of A* before giving up. More... | |
const int | Heading2X [9] |
const int | Heading2Y [9] |
const int | XY2Heading [3][3] |
void | InitPathfinder () |
Init the pathfinder. More... | |
void | FreePathfinder () |
Free the pathfinder. More... | |
int | NextPathElement (CUnit &unit, short int *xdp, short int *ydp) |
Returns the next element of the path. More... | |
int | UnitReachable (const CUnit &src, const CUnit &dst, int range, bool from_outside_container) |
Return path length to unit 'dst'. More... | |
int | CalcPathLengthToUnit (const CUnit &src, const CUnit &dst, const int minrange, const int range) |
Return path length to unit 'dst' or error code. More... | |
int | PlaceReachable (const CUnit &src, const Vec2i &pos, int w, int h, int minrange, int maxrange, bool from_outside_container) |
Can the unit 'src' reach the place x,y. More... | |
void | SetAStarFixedUnitCrossingCost (int cost) |
int | GetAStarFixedUnitCrossingCost () |
void | SetAStarMovingUnitCrossingCost (int cost) |
int | GetAStarMovingUnitCrossingCost () |
void | SetAStarUnknownTerrainCost (int cost) |
int | GetAStarUnknownTerrainCost () |
void | SetAStarFixedEnemyUnitsUnpassable (const bool value) |
bool | GetAStarFixedEnemyUnitsUnpassable () |
void | PathfinderCclRegister () |
#define AstarDebugPrint | ( | x | ) |
enum _move_return_ |
Result codes of the pathfinder.
Enumerator | |
---|---|
PF_FAILED | |
PF_UNREACHABLE | This Pathfinder failed, try another. |
PF_REACHED | Unreachable stop. |
PF_WAIT | Reached goal stop. |
PF_MOVE | Wait, no time or blocked. |
enum VisitResult |
int CalcPathLengthToUnit | ( | const CUnit & | src, |
const CUnit & | dst, | ||
const int | minrange, | ||
const int | range | ||
) |
Return path length to unit 'dst' or error code.
Calc path length for the unit 'src' to reach the unit 'dst'.
src | Unit for the path. |
dst | Unit to be reached. |
minrange | min range to the tile |
range | Range to the tile. |
change Path Finder setting to don't count tiles with enemy units as passable
restore Path Finder setting
void FreePathfinder | ( | ) |
Free the pathfinder.
Free the pathfinder
bool GetAStarFixedEnemyUnitsUnpassable | ( | ) |
int GetAStarFixedUnitCrossingCost | ( | ) |
int GetAStarMovingUnitCrossingCost | ( | ) |
int GetAStarUnknownTerrainCost | ( | ) |
void InitPathfinder | ( | ) |
Init the pathfinder.
Init the pathfinder
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. |
void PathfinderCclRegister | ( | ) |
Register CCL features for pathfinder.
int PlaceReachable | ( | const CUnit & | src, |
const Vec2i & | goalPos, | ||
int | w, | ||
int | h, | ||
int | minrange, | ||
int | range, | ||
bool | from_outside_container | ||
) |
Can the unit 'src' reach the place x,y.
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. |
change Path Finder setting to don't count tiles with enemy units as passable
restore Path Finder setting
void SetAStarFixedEnemyUnitsUnpassable | ( | const bool | value | ) |
void SetAStarFixedUnitCrossingCost | ( | int | cost | ) |
void SetAStarMovingUnitCrossingCost | ( | int | cost | ) |
void SetAStarUnknownTerrainCost | ( | int | cost | ) |
Return path length to unit 'dst'.
Can the unit 'src' reach the unit 'dst'.
src | Unit for the path. |
dst | Unit to be reached. |
range | Range to unit. |
int AStarFixedUnitCrossingCost |
cost associated to move on a tile occupied by a fixed unit
cost associated to move on a tile occupied by a fixed unit
bool AStarKnowUnseenTerrain |
Whether to have knowledge of terrain that we haven't visited yet.
int AStarMaxSearchIterations |
Maximum number of iterations of A* before giving up.
int AStarMovingUnitCrossingCost |
cost associated to move on a tile occupied by a moving unit
int AStarUnknownTerrainCost |
Cost of using a square we haven't seen before.
const int Heading2X[9] |
const int Heading2Y[9] |
const int XY2Heading[3][3] |