1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add and implement setting max_clearobjects_extra_loaded_blocks.

Now Environment::clearAllObjects() unloads unused blocks in an interval
defined by max_clearobjects_extra_loaded_blocks (default 4096).
This commit is contained in:
Kahrl 2013-06-02 15:35:29 +02:00
parent b89c79e905
commit e988df0fbd
5 changed files with 76 additions and 1 deletions

View file

@ -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();
@ -3409,6 +3414,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);