mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-03 14:52:11 +02:00
Clean the comments
This commit is contained in:
parent
d8c93cb222
commit
37f6993402
@ -117,7 +117,7 @@ ThreadSafeProxy<const rmg::Area> Zone::areaUsed() const
|
||||
|
||||
void Zone::clearTiles()
|
||||
{
|
||||
//Lock lock(mx);
|
||||
Lock lock(areaMutex);
|
||||
dArea.clear();
|
||||
dAreaPossible.clear();
|
||||
dAreaFree.clear();
|
||||
@ -126,7 +126,6 @@ void Zone::clearTiles()
|
||||
void Zone::initFreeTiles()
|
||||
{
|
||||
rmg::Tileset possibleTiles;
|
||||
//Lock lock(mx);
|
||||
vstd::copy_if(dArea.getTiles(), vstd::set_inserter(possibleTiles), [this](const int3 &tile) -> bool
|
||||
{
|
||||
return map.isPossible(tile);
|
||||
@ -239,8 +238,6 @@ TModificators Zone::getModificators()
|
||||
void Zone::connectPath(const rmg::Path & path)
|
||||
///connect current tile to any other free tile within zone
|
||||
{
|
||||
//Lock lock(areaMutex);
|
||||
|
||||
areaPossible()->subtract(path.getPathArea());
|
||||
freePaths()->unite(path.getPathArea());
|
||||
for(const auto & t : path.getPathArea().getTilesVector())
|
||||
|
@ -477,7 +477,6 @@ void ConnectionsPlacer::createBorder()
|
||||
}
|
||||
};
|
||||
|
||||
//Zone::Lock lock(zone.areaMutex); //Protect from erasing same tiles again
|
||||
auto areaPossible = zone.areaPossible();
|
||||
for(const auto & tile : blockBorder.getTilesVector())
|
||||
{
|
||||
|
@ -118,19 +118,14 @@ void ObjectManager::updateDistances(const int3 & pos)
|
||||
|
||||
void ObjectManager::updateDistances(std::function<ui32(const int3 & tile)> distanceFunction)
|
||||
{
|
||||
// Workaround to avoid dealock when accessed from other zone
|
||||
// Workaround to avoid deadlock when accessed from other zone
|
||||
RecursiveLock lock(zone.areaMutex, boost::try_to_lock);
|
||||
if (!lock.owns_lock())
|
||||
{
|
||||
// Sorry, unsolvable problem of mutual impact¯\_(ツ)_/¯
|
||||
// Unsolvable problem of mutual access
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Update map distances - Requires lock on zone area only
|
||||
2. Update tilesByDistance priority queue - Requires lock area AND externalAccessMutex
|
||||
*/
|
||||
|
||||
const auto tiles = zone.areaPossible()->getTilesVector();
|
||||
//RecursiveLock lock(externalAccessMutex);
|
||||
tilesByDistance.clear();
|
||||
@ -619,15 +614,8 @@ void ObjectManager::placeObject(rmg::Object & object, bool guarded, bool updateD
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Possible deadlock by two managers updating each other
|
||||
// At this point areaMutex is locked
|
||||
// TODO: Generic function for multiple spinlocks
|
||||
//std::vector sorted(adjacentZones.begin(), adjacentZones.end());
|
||||
//std::sort(sorted.begin(), sorted.end());
|
||||
//for (auto id : adjacentZones)
|
||||
..for (auto id : sorted)
|
||||
for (auto id : sorted)
|
||||
{
|
||||
//TODO: Test again with sorted order?
|
||||
auto otherZone = map.getZones().at(id);
|
||||
if ((otherZone->getType() == ETemplateZoneType::WATER) == (zone.getType() == ETemplateZoneType::WATER))
|
||||
{
|
||||
|
@ -37,7 +37,6 @@ void ObstaclePlacer::process()
|
||||
collectPossibleObstacles(zone.getTerrainType());
|
||||
|
||||
{
|
||||
//Zone::Lock lock(zone.areaMutex);
|
||||
auto area = zone.area();
|
||||
auto areaPossible = zone.areaPossible();
|
||||
auto areaUsed = zone.areaUsed();
|
||||
|
@ -918,7 +918,7 @@ void TreasurePlacer::createTreasures(ObjectManager& manager)
|
||||
|
||||
{
|
||||
Zone::Lock lock(zone.areaMutex); //We are going to subtract this area
|
||||
// FIXME: Possible area will be regenerated for every object
|
||||
|
||||
auto searchArea = zone.areaPossible().get();
|
||||
searchArea.erase_if([this, &minDistance](const int3& tile) -> bool
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user