- fixed a bad memory leak in the pathfinder
This commit is contained in:
parent
6d3f6dcaf4
commit
ed8c08de2f
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue