📄 pathfinder.h
字号:
/***********************
* _PathFinder_h_ *
* A* path finder *
* create by si.si *
* 07.10.18 *
************************/
#ifndef _PathFinder_h_
#define _PathFinder_h_
#include "DList.h"
using namespace SSDataS;
//name space sisi's game AI
namespace SSGameAI
{
struct Point
{
long x;
long y;
};
typedef DListNode<Point> Path;
//class PathFinder
class PathFinder
{
//constructor and destructor
public:
PathFinder(int tlen , int* tArray , long SceneW , long SceneH , long mw , long mh);
PathFinder();
~PathFinder();
//Set method
void setTileLen( int tlen );
void setTileArray( int* tArray );
void setSceneWidth( long SceneW );
void setSceneHeight( long SceneH );
void setMaxRange( long mw , long mh );
//get method
int getTileLen() const;
int getHalfTileLen() const;
int* getTileArray() const;
long getMaxStep() const;
long getStepCount() const;
long getSceneWidth() const;
long getSceneHeight() const;
long getSceneTWidth() const;
long getSceneTHeight() const;
//function method
long makeTile( int x , int y );
long getTileFromPos( Point pos );
Point getPointFromTile(long t );
long distance( Point StartPos , Point DestPos );
long distance( long StartTile , long DestTile );
Point adjustPos( Point pos );
long* getAroundTile( Point pos );
long getNearTile( Point pos , Point DestPos);
bool movable( Point StartPos , Point DestPos , Path* &pPath , bool flags );
Path* getLastMember( Path* pPath );
bool isWalkableTile( long tileId );
long doFor( long index , long flags );
Point getNextPos( Point pos , long* RelateTile , long flags);
bool isOldPos( Point NextPos , Path* pPath );
void deletePath( Path* pPath );
bool arcSearch( Point StartPos , Point DestPos , Path* &pPath , Path* pOldPath , long flags);
bool roundSearch( Point StartPos , Point DestPos , Path* &pPath , long flags );
Path* method1( Point pos , Point DestPos , long* get , long flags );
Path* method2( Point pos , Point DestPos , long* get , long flags );
Path* method3(SSGameAI::Point pos, SSGameAI::Point DestPos,Path* pPath1, long *get, long flags);
bool getBasicPath( Point StartPos , Point DestPos , Path* &pPath, long* get , long flags );
long getPathCount( Path* pPath );
Path* getTheBestPath( Point StartPos , Point DestPos , long flags );
private:
int TileLen;
int HalfTLen;
int* TileArray;
long MaxStep;
long StepCount;
long SceneWidth;
long SceneHeight;
long SceneTWidth;
long SceneTHeight;
long maxw;
long maxh;
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -