mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +00:00
Reduce critical sections size
This commit is contained in:
parent
a5b078e9a7
commit
563f3f87dd
@ -38,8 +38,9 @@ namespace DetourNavigator
|
||||
return false;
|
||||
std::vector<TilePosition> tilesPositions;
|
||||
{
|
||||
const TilesPositionsRange range = makeTilesPositionsRange(shape.getShape(), transform, mSettings);
|
||||
const std::lock_guard lock(mMutex);
|
||||
getTilesPositions(makeTilesPositionsRange(shape.getShape(), transform, mSettings),
|
||||
getTilesPositions(range,
|
||||
[&] (const TilePosition& tilePosition)
|
||||
{
|
||||
if (addTile(id, shape, transform, areaType, tilePosition, mTiles))
|
||||
|
@ -38,7 +38,6 @@ namespace DetourNavigator
|
||||
bool changed = false;
|
||||
std::vector<TilePosition> newTiles;
|
||||
{
|
||||
const std::lock_guard lock(mMutex);
|
||||
const auto onTilePosition = [&] (const TilePosition& tilePosition)
|
||||
{
|
||||
if (std::binary_search(currentTiles.begin(), currentTiles.end(), tilePosition))
|
||||
@ -57,7 +56,9 @@ namespace DetourNavigator
|
||||
changed = true;
|
||||
}
|
||||
};
|
||||
getTilesPositions(makeTilesPositionsRange(shape.getShape(), transform, mSettings), onTilePosition);
|
||||
const TilesPositionsRange range = makeTilesPositionsRange(shape.getShape(), transform, mSettings);
|
||||
const std::lock_guard lock(mMutex);
|
||||
getTilesPositions(range, onTilePosition);
|
||||
std::sort(newTiles.begin(), newTiles.end());
|
||||
for (const auto& tile : currentTiles)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user