- fixed a bad memory leak in the pathfinder

This commit is contained in:
Mark Vejvoda 2010-07-30 01:05:52 +00:00
parent 6d3f6dcaf4
commit ed8c08de2f
1 changed files with 6 additions and 1 deletions

View File

@ -42,17 +42,22 @@ PathFinder::PathFinder(){
}
PathFinder::PathFinder(const Map *map){
init(map);
nodePool= NULL;
init(map);
}
void PathFinder::init(const Map *map){
if(nodePool != NULL) {
delete [] nodePool;
nodePool = NULL;
}
nodePool= new Node[pathFindNodesMax];
this->map= map;
}
PathFinder::~PathFinder(){
delete [] nodePool;
nodePool = NULL;
}
TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos){