68644fb42b
- Pulled out the A* implementation to a separate class to support reuse of code for the high level pathfinder - Cached the the open/closed status of nodes to improve speed - Added a maximum node limit before the search is cut off (DEFAULT_SEARCH_LIMIT in AStarEngine.cpp for now) - Allied unit collisions are now ignored This was SVN commit r3861.
42 lines
918 B
C++
42 lines
918 B
C++
// PathfindEngine.h
|
|
//
|
|
// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com
|
|
//
|
|
// The pathfinding engine singleton.
|
|
//
|
|
// Usage: g_Pathfinder.requestPath( HEntity me, float x, float y );
|
|
//
|
|
// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com
|
|
|
|
#ifndef PATHFIND_ENGINE_INCLUDED
|
|
#define PATHFIND_ENGINE_INCLUDED
|
|
|
|
#include "Singleton.h"
|
|
#include "EntityHandles.h"
|
|
#include "Vector2D.h"
|
|
#include "AStarEngine.h"
|
|
|
|
#define g_Pathfinder CPathfindEngine::GetSingleton()
|
|
|
|
class CEntityOrder;
|
|
|
|
enum EPathType
|
|
{
|
|
PF_STANDARD,
|
|
PF_ATTACK_MELEE,
|
|
};
|
|
|
|
|
|
class CPathfindEngine : public Singleton<CPathfindEngine>
|
|
{
|
|
public:
|
|
CPathfindEngine();
|
|
void requestPath( HEntity entity, const CVector2D& destination );
|
|
void requestLowLevelPath( HEntity entity, const CVector2D& destination, bool contact );
|
|
void requestContactPath( HEntity entity, CEntityOrder* current );
|
|
private:
|
|
CAStarEngineLowLevel mLowPathfinder;
|
|
};
|
|
|
|
#endif
|