1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Optimized map saving and sending (server-side)

This commit is contained in:
Perttu Ahola 2011-04-26 00:23:38 +03:00
parent 42fb1ba676
commit 2830095366
7 changed files with 174 additions and 61 deletions

View file

@ -401,6 +401,35 @@ public:
}
return true;
}
/*
Returns true if any chunk is marked as modified
*/
bool anyChunkModified()
{
for(core::map<v2s16, MapChunk*>::Iterator
i = m_chunks.getIterator();
i.atEnd()==false; i++)
{
v2s16 p = i.getNode()->getKey();
MapChunk *chunk = i.getNode()->getValue();
if(chunk->isModified())
return true;
}
return false;
}
void setChunksNonModified()
{
for(core::map<v2s16, MapChunk*>::Iterator
i = m_chunks.getIterator();
i.atEnd()==false; i++)
{
v2s16 p = i.getNode()->getKey();
MapChunk *chunk = i.getNode()->getValue();
chunk->setModified(false);
}
}
/*
Chunks are generated by using these and makeChunk().
@ -573,6 +602,12 @@ private:
s16 m_chunksize;
// Chunks
core::map<v2s16, MapChunk*> m_chunks;
/*
Metadata is re-written on disk only if this is true.
This is reset to false when written on disk.
*/
bool m_map_metadata_changed;
};
/*