00001
00007 #ifndef _ASTAR_H_
00008 #define _ASTAR_H_
00009
00010 #include "AStarTile.h"
00011 #include "IsoBomb.h"
00012
00016 class AStar {
00017
00018 public:
00019
00023 AStar();
00024
00028 ~AStar();
00029
00037 bool findpath( const Point& source, const Point& dest );
00038
00044 Point getNextPoint();
00045
00051 bool hasMorePoints();
00052
00053 private:
00054
00058 void clear();
00059
00068 int getManhattanDistance( int x, int y );
00069
00074 void processTile( AStarTile* parent, int x, int y );
00075
00076 private:
00077
00081 int numTilesX;
00082
00086 int numTilesY;
00087
00091 int sourceX;
00092
00096 int sourceY;
00097
00101 int destX;
00102
00106 int destY;
00107
00112 std::set<AStarTileKey> sortedList;
00113
00117 std::map<Point,AStarTile*> openList;
00118
00122 std::map<Point,AStarTile*> closedList;
00123
00127 std::map<Point,AStarTile*>::iterator openIt;
00128
00132 std::map<Point,AStarTile*>::iterator closedIt;
00133
00137 std::set<AStarTileKey>::iterator sortedIt;
00138
00142 std::list<Point> path;
00143
00144 };
00145
00146 #endif