aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-09-06 19:16:36 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-09-06 19:16:36 +0300
commit3c30ab28070d206585047640d0c293912208e37d (patch)
tree7f02270ba05134e8f0dfa90236fe79fc72576ebd /src
parent310fa10035568f517de0f45ff5dfa544bbdfe9de (diff)
downloadminetest-3c30ab28070d206585047640d0c293912208e37d.tar.gz
minetest-3c30ab28070d206585047640d0c293912208e37d.tar.bz2
minetest-3c30ab28070d206585047640d0c293912208e37d.zip
Speed up periodical map unloading by moving beginSave() and endSave() to outer loop in Map::timerUpdate()
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 5e2fd558c..423a07dcd 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1408,6 +1408,7 @@ void Map::timerUpdate(float dtime, float unload_timeout,
core::map<v2s16, MapSector*>::Iterator si;
+ beginSave();
si = m_sectors.getIterator();
for(; si.atEnd() == false; si++)
{
@@ -1418,7 +1419,6 @@ void Map::timerUpdate(float dtime, float unload_timeout,
core::list<MapBlock*> blocks;
sector->getBlocks(blocks);
- beginSave();
for(core::list<MapBlock*>::Iterator i = blocks.begin();
i != blocks.end(); i++)
{
@@ -1451,13 +1451,13 @@ void Map::timerUpdate(float dtime, float unload_timeout,
all_blocks_deleted = false;
}
}
- endSave();
if(all_blocks_deleted)
{
sector_deletion_queue.push_back(si.getNode()->getKey());
}
}
+ endSave();
// Finally delete the empty sectors
deleteSectors(sector_deletion_queue);