@@ -28,6 +28,13 @@ void AIPathfinder::clear()
storageMap.clear();
}
+void AIPathfinder::init()
+{
+ boost::unique_lock<boost::mutex> storageLock(storageMutex);
+ storagePool.clear();
+ storageMap.clear();
+}
+
std::vector<AIPath> AIPathfinder::getPathInfo(HeroPtr hero, int3 tile)
{
boost::unique_lock<boost::mutex> storageLock(storageMutex);
@@ -27,4 +27,5 @@ public:
AIPathfinder(CPlayerSpecificInfoCallback * cb, VCAI * ai);
std::vector<AIPath> getPathInfo(HeroPtr hero, int3 tile);
void clear();
+ void init();
};
@@ -24,6 +24,7 @@ void PathfindingManager::init(CPlayerSpecificInfoCallback * CB)
cb = CB;
pathfinder.reset(new AIPathfinder(cb, ai));
+ pathfinder->init();
void PathfindingManager::setAI(VCAI * AI)