|
|
@@ -7,6 +7,7 @@
|
|
|
#include "mapObjects/CGHeroInstance.h"
|
|
|
#include "GameConstants.h"
|
|
|
#include "CStopWatch.h"
|
|
|
+#include "CThreadHelper.h"
|
|
|
|
|
|
/*
|
|
|
* CPathfinder.cpp, part of VCMI engine
|
|
|
@@ -59,6 +60,24 @@ CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance
|
|
|
neighbours.reserve(16);
|
|
|
}
|
|
|
|
|
|
+void CPathfinder::startPathfinder()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ setThreadName("CPathfinder::startPathfinder");
|
|
|
+
|
|
|
+ calculatePaths();
|
|
|
+ }
|
|
|
+ catch(boost::thread_interrupted &e)
|
|
|
+ {
|
|
|
+ gs->pathfinderWorking.reset();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ gs->pathfinderWorking.reset();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
void CPathfinder::calculatePaths()
|
|
|
{
|
|
|
int maxMovePointsLand = hero->maxMovePoints(true);
|
|
|
@@ -192,6 +211,8 @@ void CPathfinder::calculatePaths()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ boost::this_thread::interruption_point();
|
|
|
} //queue loop
|
|
|
}
|
|
|
|