summaryrefslogtreecommitdiffstats
path: root/source/WSSCompact.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-28 11:45:53 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-28 11:45:53 +0100
commit230f98a774d956934e42cb4ba7b2cddcdc365676 (patch)
tree0049f65fefb73d9bd8c4c3adcc076634451d5271 /source/WSSCompact.h
parentVC2008: slight project reorganization, chunk-generation-related sources are now in one folder (diff)
downloadcuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.gz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.bz2
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.lz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.xz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.zst
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.zip
Diffstat (limited to 'source/WSSCompact.h')
-rw-r--r--source/WSSCompact.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/WSSCompact.h b/source/WSSCompact.h
index a2bfc4d20..1cb8d161b 100644
--- a/source/WSSCompact.h
+++ b/source/WSSCompact.h
@@ -37,6 +37,10 @@ protected:
cPAKFile(const AString & a_FileName, int a_LayerX, int a_LayerZ);
~cPAKFile();
+ bool GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data);
+ bool SetChunkData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data);
+ bool EraseChunkData(const cChunkCoords & a_Chunk);
+
bool SaveChunk(const cChunkCoords & a_Chunk, cWorld * a_World);
bool LoadChunk(const cChunkCoords & a_Chunk, cWorld * a_World);
@@ -55,19 +59,32 @@ protected:
int m_NumDirty; // Number of chunks that were written into m_DataContents but not into the file
bool LoadChunk(const cChunkCoords & a_Chunk, int a_Offset, sChunkHeader * a_Header, cWorld * a_World);
- void EraseChunk(const cChunkCoords & a_Chunk); // Erases the chunk data from m_DataContents and updates m_ChunkHeaders
bool SaveChunkToData(const cChunkCoords & a_Chunk, cWorld * a_World); // Saves the chunk to m_DataContents, updates headers and m_NumDirty
void SynchronizeFile(void); // Writes m_DataContents along with the headers to file, resets m_NumDirty
- void LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World);
} ;
typedef std::list<cPAKFile *> cPAKFiles;
+ cCriticalSection m_CS;
cPAKFiles m_PAKFiles; // A MRU cache of PAK files
/// Loads the correct PAK file either from cache or from disk, manages the m_PAKFiles cache
cPAKFile * LoadPAKFile(const cChunkCoords & a_Chunk);
+ /// Gets chunk data from the correct file; locks CS as needed
+ bool GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data);
+
+ /// Sets chunk data to the correct file; locks CS as needed
+ bool SetChunkData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data);
+
+ /// Erases chunk data from the correct file; locks CS as needed
+ bool EraseChunkData(const cChunkCoords & a_Chunk);
+
+ /// Loads the chunk from the data (no locking needed)
+ bool LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWorld * a_World);
+
+ void LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World);
+
// cWSSchema overrides:
virtual bool LoadChunk(const cChunkCoords & a_Chunk) override;
virtual bool SaveChunk(const cChunkCoords & a_Chunk) override;