From 9b565b6bc427673437c28518d1f61c13b58be42e Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 5 Jun 2011 18:57:36 +0300 Subject: tried to reduce unnecessary map saving disk i/o a bit --- src/map.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 579f30e9a..ba361b393 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4987,9 +4987,7 @@ void ServerMap::save(bool only_changed) u32 sector_meta_count = 0; u32 block_count = 0; - - { //sectorlock - //JMutexAutoLock lock(m_sector_mutex); // Bulk comment-out + u32 block_count_all = 0; // Number of blocks in memory core::map::Iterator i = m_sectors.getIterator(); for(; i.atEnd() == false; i++) @@ -5008,6 +5006,9 @@ void ServerMap::save(bool only_changed) for(j=blocks.begin(); j!=blocks.end(); j++) { MapBlock *block = *j; + + block_count_all++; + if(block->getChangedFlag() || only_changed == false) { saveBlock(block); @@ -5022,8 +5023,6 @@ void ServerMap::save(bool only_changed) } } - }//sectorlock - /* Only print if something happened or saved whole map */ @@ -5033,6 +5032,7 @@ void ServerMap::save(bool only_changed) dstream<