diff options
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp index 43502253b..001ae1609 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1510,6 +1510,11 @@ void Map::timerUpdate(float dtime, float unload_timeout, } } +void Map::unloadUnreferencedBlocks(std::list<v3s16> *unloaded_blocks) +{ + timerUpdate(0.0, -1.0, unloaded_blocks); +} + void Map::deleteSectors(std::list<v2s16> &list) { for(std::list<v2s16>::iterator j = list.begin(); @@ -1646,10 +1651,12 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks) // List of MapBlocks that will require a lighting update (due to lava) std::map<v3s16, MapBlock*> lighting_modified_blocks; + u16 loop_max = g_settings->getU16("liquid_loop_max"); + while (m_transforming_liquid.size() > 0) { // This should be done here so that it is done when continue is used - if (loopcount >= initial_size || loopcount >= 1000) + if (loopcount >= initial_size || loopcount >= loop_max) break; loopcount++; /* @@ -1988,10 +1995,12 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks) // List of MapBlocks that will require a lighting update (due to lava) std::map<v3s16, MapBlock*> lighting_modified_blocks; + u16 loop_max = g_settings->getU16("liquid_loop_max"); + while(m_transforming_liquid.size() != 0) { // This should be done here so that it is done when continue is used - if(loopcount >= initial_size || loopcount >= 10000) + if(loopcount >= initial_size || loopcount >= loop_max) break; loopcount++; @@ -3409,6 +3418,26 @@ void ServerMap::listAllLoadableBlocks(std::list<v3s16> &dst) } } +void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst) +{ + for(std::map<v2s16, MapSector*>::iterator si = m_sectors.begin(); + si != m_sectors.end(); ++si) + { + MapSector *sector = si->second; + + std::list<MapBlock*> blocks; + sector->getBlocks(blocks); + + for(std::list<MapBlock*>::iterator i = blocks.begin(); + i != blocks.end(); ++i) + { + MapBlock *block = (*i); + v3s16 p = block->getPos(); + dst.push_back(p); + } + } +} + void ServerMap::saveMapMeta() { DSTACK(__FUNCTION_NAME); |