1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Remove no longer needed synchronization that also fails to compile.

This commit is contained in:
Tomasz Zieliński 2023-05-20 13:15:46 +02:00
parent 219e897db0
commit 91baa65c8c
3 changed files with 3 additions and 54 deletions

View File

@ -66,28 +66,6 @@ protected:
using RecursiveLock = boost::unique_lock<boost::recursive_mutex>;
using Lock = boost::unique_lock<boost::shared_mutex>;
template <typename TModificator>
std::vector<RecursiveLock> tryLockAll()
{
std::vector<RecursiveLock> locks;
for (auto & zone : map.getZones())
{
if (auto * m = zone.second->getModificator<TModificator>())
{
RecursiveLock lock(m->externalAccessMutex, boost::try_to_lock_t{});
if (lock.owns_lock())
{
locks.emplace_back(std::move(lock));
}
else //return empty
{
return std::vector<RecursiveLock>();
}
}
}
return locks;
}
private:
virtual void process() = 0;

View File

@ -27,22 +27,8 @@ VCMI_LIB_NAMESPACE_BEGIN
void ObjectDistributor::process()
{
//Do that only once
auto lockVec = tryLockAll<ObjectDistributor>();
if (!lockVec.empty())
{
for(auto & z : map.getZones())
{
if(auto * m = z.second->getModificator<ObjectDistributor>())
{
if(m->isFinished())
return;
}
}
distributeLimitedObjects();
distributeSeerHuts();
finished = true;
}
distributeLimitedObjects();
distributeSeerHuts();
}
void ObjectDistributor::init()

View File

@ -30,22 +30,7 @@ class TileInfo;
void RockFiller::process()
{
//Do that only once
auto lockVec = tryLockAll<RockFiller>();
if (!lockVec.empty())
{
for(auto & z : map.getZones())
{
if(auto * m = z.second->getModificator<RockFiller>())
{
if(m->isFinished())
return;
}
}
logGlobal->info("Processing RockFiller for the whole map");
processMap();
finished = true; //Block other placers immediately
}
processMap();
}
void RockFiller::processMap()