diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index f0b280d7..4a05dea4 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -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){