mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Speed up periodical map unloading by moving beginSave() and endSave() to outer loop in Map::timerUpdate()
This commit is contained in:
parent
310fa10035
commit
3c30ab2807
1 changed files with 2 additions and 2 deletions
|
@ -1408,6 +1408,7 @@ void Map::timerUpdate(float dtime, float unload_timeout,
|
||||||
|
|
||||||
core::map<v2s16, MapSector*>::Iterator si;
|
core::map<v2s16, MapSector*>::Iterator si;
|
||||||
|
|
||||||
|
beginSave();
|
||||||
si = m_sectors.getIterator();
|
si = m_sectors.getIterator();
|
||||||
for(; si.atEnd() == false; si++)
|
for(; si.atEnd() == false; si++)
|
||||||
{
|
{
|
||||||
|
@ -1418,7 +1419,6 @@ void Map::timerUpdate(float dtime, float unload_timeout,
|
||||||
core::list<MapBlock*> blocks;
|
core::list<MapBlock*> blocks;
|
||||||
sector->getBlocks(blocks);
|
sector->getBlocks(blocks);
|
||||||
|
|
||||||
beginSave();
|
|
||||||
for(core::list<MapBlock*>::Iterator i = blocks.begin();
|
for(core::list<MapBlock*>::Iterator i = blocks.begin();
|
||||||
i != blocks.end(); i++)
|
i != blocks.end(); i++)
|
||||||
{
|
{
|
||||||
|
@ -1451,13 +1451,13 @@ void Map::timerUpdate(float dtime, float unload_timeout,
|
||||||
all_blocks_deleted = false;
|
all_blocks_deleted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endSave();
|
|
||||||
|
|
||||||
if(all_blocks_deleted)
|
if(all_blocks_deleted)
|
||||||
{
|
{
|
||||||
sector_deletion_queue.push_back(si.getNode()->getKey());
|
sector_deletion_queue.push_back(si.getNode()->getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
endSave();
|
||||||
|
|
||||||
// Finally delete the empty sectors
|
// Finally delete the empty sectors
|
||||||
deleteSectors(sector_deletion_queue);
|
deleteSectors(sector_deletion_queue);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue