diff options
author | Mattes D <github@xoft.cz> | 2014-06-16 16:00:14 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-06-16 16:00:14 +0200 |
commit | 24b0878af753c0873f71c738be0c1ac94f6c062b (patch) | |
tree | 01275c7080eb2cc3c821a2a398f8f2d2f78ff47c /src/ChunkMap.h | |
parent | Fixed a copypasta error in WormNestCaves generator settings. (diff) | |
parent | Added override (diff) | |
download | cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.gz cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.bz2 cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.lz cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.xz cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.tar.zst cuberite-24b0878af753c0873f71c738be0c1ac94f6c062b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ChunkMap.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 7e85bb6f1..5aad0dd2a 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -351,7 +351,11 @@ private: class cChunkLayer { public: - cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent); + cChunkLayer( + int a_LayerX, int a_LayerZ, + cChunkMap * a_Parent, + cAllocationPool<cChunkData::sChunkSection> & a_Pool + ); ~cChunkLayer(); /** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */ @@ -395,6 +399,25 @@ private: int m_LayerZ; cChunkMap * m_Parent; int m_NumChunksLoaded; + + cAllocationPool<cChunkData::sChunkSection> & m_Pool; + }; + + class cStarvationCallbacks + : public cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks + { + virtual void OnStartUsingReserve() override + { + LOG("Using backup memory buffer"); + } + virtual void OnEndUsingReserve() override + { + LOG("Stoped using backup memory buffer"); + } + virtual void OnOutOfReserve() override + { + LOG("Out of Memory"); + } }; typedef std::list<cChunkLayer *> cChunkLayerList; @@ -427,6 +450,8 @@ private: /** The cChunkStay descendants that are currently enabled in this chunkmap */ cChunkStays m_ChunkStays; + std::auto_ptr<cAllocationPool<cChunkData::sChunkSection>> m_Pool; + cChunkPtr GetChunk (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading / generating if not valid cChunkPtr GetChunkNoGen (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading if not valid; doesn't generate cChunkPtr GetChunkNoLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Doesn't load, doesn't generate |