1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-11 13:15:38 +02:00

Revert "Pathfinding: do path calculation in separate thread"

This reverts commit f376b2799941638fc3ac8f0ea4cb57da7d38ae12.
This commit is contained in:
ArseniyShestakov 2015-11-09 09:35:56 +03:00
parent f376b27999
commit 45e4cf354e
4 changed files with 1 additions and 28 deletions

View File

@ -2164,11 +2164,8 @@ void CGameState::apply(CPack *pack)
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out)
{
if(pathfinderWorking)
pathfinderWorking->interrupt();
CPathfinder pathfinder(out, this, hero);
pathfinderWorking = make_unique<boost::thread>(&CPathfinder::startPathfinder, pathfinder);
pathfinder.calculatePaths();
}
/**

View File

@ -314,8 +314,6 @@ public:
boost::shared_mutex *mx;
unique_ptr<boost::thread> pathfinderWorking;
void giveHeroArtifact(CGHeroInstance *h, ArtifactID aid);
void apply(CPack *pack);

View File

@ -7,7 +7,6 @@
#include "mapObjects/CGHeroInstance.h"
#include "GameConstants.h"
#include "CStopWatch.h"
#include "CThreadHelper.h"
/*
* CPathfinder.cpp, part of VCMI engine
@ -60,24 +59,6 @@ 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);
@ -211,8 +192,6 @@ void CPathfinder::calculatePaths()
}
}
}
boost::this_thread::interruption_point();
} //queue loop
}

View File

@ -91,7 +91,6 @@ class CPathfinder : private CGameInfoCallback
{
public:
CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance *_hero);
void startPathfinder();
void calculatePaths(); //calculates possible paths for hero, uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists
private: