00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __PATH_FINDER_H__
00031 #define __PATH_FINDER_H__
00032
00034
00035 #ifndef STDCALL
00036 #ifdef _MSC_VER
00037 #define STDCALL __stdcall
00038 #else
00039 #define STDCALL
00040 #endif
00041 #endif
00042
00043 #if defined(DEBUG_ASTAR)
00044 #define AstarDebugPrint(x) DebugPrint(x)
00045 #else
00046 #define AstarDebugPrint(x)
00047 #endif
00048
00049
00050
00051
00052
00053 class CUnit;
00054
00062 enum _move_return_ {
00063 PF_FAILED = -3,
00064 PF_UNREACHABLE = -2,
00065 PF_REACHED = -1,
00066 PF_WAIT = 0,
00067 PF_MOVE = 1
00068 };
00069
00073 #define NewResetPath(unit) \
00074 do { (unit).Data.Move.Fast = 1; (unit).Data.Move.Length = 0; } while (0)
00075
00076
00077
00078
00079
00081 extern int AStarFixedUnitCrossingCost;
00083 extern int AStarMovingUnitCrossingCost;
00085 extern bool AStarKnowUnseenTerrain;
00087 extern int AStarUnknownTerrainCost;
00088
00089
00090
00091
00092 extern const int Heading2X[9];
00093 extern const int Heading2Y[9];
00094 extern const int XY2Heading[3][3];
00095
00096
00097
00098
00099
00101 extern void InitPathfinder();
00103 extern void FreePathfinder();
00104
00106 extern unsigned char *CreateMatrix();
00108 extern unsigned char *MakeMatrix();
00110 extern int NewPath(CUnit &unit);
00112 extern int NextPathElement(CUnit &unit, short int *xdp, short int *ydp);
00114 extern int UnitReachable(const CUnit &unit, const CUnit &dst, int range);
00116 extern int PlaceReachable(const CUnit &src, int x, int y, int w, int h,
00117 int minrange, int maxrange);
00118
00119
00120
00121
00122
00123 extern void SetAStarFixedUnitCrossingCost(int cost);
00124 extern int GetAStarFixedUnitCrossingCost();
00125
00126 extern void SetAStarMovingUnitCrossingCost(int cost);
00127 extern int GetAStarMovingUnitCrossingCost();
00128
00129 extern void SetAStarUnknownTerrainCost(int cost);
00130 extern int GetAStarUnknownTerrainCost();
00131
00132 extern void PathfinderCclRegister();
00133
00135
00136 #endif // !__PATH_FINDER_H__