mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Code cleanup
This commit is contained in:
parent
a89abf0289
commit
a94286c23d
@ -352,7 +352,6 @@ void Zone::fractalize()
|
||||
}
|
||||
}
|
||||
|
||||
//Lock lock(areaMutex);
|
||||
//Connect with free areas
|
||||
auto areas = connectedAreas(clearedTiles, true);
|
||||
for(auto & area : areas)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -65,7 +65,7 @@ void RockFiller::init()
|
||||
}
|
||||
|
||||
char RockFiller::dump(const int3 & t)
|
||||
{
|
||||
{
|
||||
if(!map.getTile(t).terType->isPassable())
|
||||
{
|
||||
return zone.area()->contains(t) ? 'R' : 'E';
|
||||
|
@ -918,7 +918,7 @@ void TreasurePlacer::createTreasures(ObjectManager& manager)
|
||||
|
||||
{
|
||||
Zone::Lock lock(zone.areaMutex); //We are going to subtract this area
|
||||
|
||||
|
||||
auto searchArea = zone.areaPossible().get();
|
||||
searchArea.erase_if([this, &minDistance](const int3& tile) -> bool
|
||||
{
|
||||
@ -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())
|
||||
{
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user