mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Optimized map saving and sending (server-side)
This commit is contained in:
35
src/map.h
35
src/map.h
@@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user