1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Code cleanup

This commit is contained in:
Tomasz Zieliński 2024-03-27 08:03:19 +01:00
parent a89abf0289
commit a94286c23d
6 changed files with 2 additions and 10 deletions

View File

@ -352,7 +352,6 @@ void Zone::fractalize()
}
}
//Lock lock(areaMutex);
//Connect with free areas
auto areas = connectedAreas(clearedTiles, true);
for(auto & area : areas)

View File

@ -35,7 +35,6 @@ std::pair<Zone::Lock, Zone::Lock> ConnectionsPlacer::lockZones(std::shared_ptr<Z
while (true)
{
// FIXME: What if every zone owns its own lock?
auto lock1 = Zone::Lock(zone.areaMutex, boost::try_to_lock);
auto lock2 = Zone::Lock(otherZone->areaMutex, boost::try_to_lock);
@ -59,7 +58,6 @@ void ConnectionsPlacer::process()
while (cp)
{
// FIXME: It does lock ConnectionPlacer, but not areaMutex
RecursiveLock lock1(externalAccessMutex, boost::try_to_lock);
RecursiveLock lock2(cp->externalAccessMutex, boost::try_to_lock);
if (lock1.owns_lock() && lock2.owns_lock())
@ -292,7 +290,6 @@ void ConnectionsPlacer::selfSideDirectConnection(const rmg::ZoneConnection & con
zone.freePaths()->add(guardPos);
map.setOccupied(guardPos, ETileType::FREE);
manager.updateDistances(guardPos);
// FIXME: Accessing other manager might lead to deadlock
otherZone->getModificator<ObjectManager>()->updateDistances(guardPos);
}

View File

@ -273,7 +273,6 @@ int3 ObjectManager::findPlaceForObject(const rmg::Area & searchArea, rmg::Object
rmg::Path ObjectManager::placeAndConnectObject(const rmg::Area & searchArea, rmg::Object & obj, si32 min_dist, bool isGuarded, bool onlyStraight, OptimizeType optimizer) const
{
//RecursiveLock lock(externalAccessMutex);
return placeAndConnectObject(searchArea, obj, [this, min_dist, &obj](const int3 & tile)
{
float bestDistance = 10e9;

View File

@ -954,7 +954,6 @@ void TreasurePlacer::createTreasures(ObjectManager& manager)
path = manager.placeAndConnectObject(searchArea, rmgObject, minDistance, guarded, false, ObjectManager::OptimizeType::DISTANCE);
}
}
//lock.unlock();
if (path.valid())
{

View File

@ -43,8 +43,6 @@ void WaterRoutes::process()
result.push_back(wproxy->waterRoute(*z.second));
}
//Zone::Lock lock(zone.areaMutex);
auto area = zone.area();
auto freePaths = zone.freePaths();
auto areaPossible = zone.areaPossible();