summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2023-05-26 13:17:13 +0200
committerMattes D <github@xoft.cz>2023-05-26 23:00:17 +0200
commit20f3cb34aec0cddfe824d9cdc6696cf15b62c28b (patch)
tree50e0e6fb485344086cef7ae35ddf6e05cc9c8499 /src/WorldStorage/WSSAnvil.h
parentAnvil: Allow loading chunks without HeightMap. (diff)
downloadcuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar.gz
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar.bz2
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar.lz
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar.xz
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.tar.zst
cuberite-20f3cb34aec0cddfe824d9cdc6696cf15b62c28b.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/WSSAnvil.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h
index 69006ec95..e0c9a9320 100644
--- a/src/WorldStorage/WSSAnvil.h
+++ b/src/WorldStorage/WSSAnvil.h
@@ -83,10 +83,13 @@ protected:
/** Opens a MCA file either for a Read operation (fails if doesn't exist) or for a Write operation (creates new if not found) */
bool OpenFile(bool a_IsForReading);
} ;
- typedef std::list<cMCAFile *> cMCAFiles;
+ /** Protects m_Files against multithreaded access. */
cCriticalSection m_CS;
- cMCAFiles m_Files; // a MRU cache of MCA files
+
+ /** A MRU cache of MCA files.
+ Protected against multithreaded access by m_CS. */
+ std::list<std::shared_ptr<cMCAFile>> m_Files;
Compression::Extractor m_Extractor;
Compression::Compressor m_Compressor;
@@ -291,7 +294,7 @@ protected:
bool GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, Vector3i & a_AbsPos);
/** Gets the correct MCA file either from cache or from disk, manages the m_MCAFiles cache; assumes m_CS is locked */
- cMCAFile * LoadMCAFile(const cChunkCoords & a_Chunk);
+ std::shared_ptr<cMCAFile> LoadMCAFile(const cChunkCoords & a_Chunk);
// cWSSchema overrides:
virtual bool LoadChunk(const cChunkCoords & a_Chunk) override;