summaryrefslogtreecommitdiffstats
path: root/source/WorldStorage.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-26 17:46:23 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-26 17:46:23 +0100
commit1f88db187bbc1bacc29a2f263c73ff383aa06e91 (patch)
treed8332cf8d866223b47b579a65fb3e2a2d41e92fc /source/WorldStorage.h
parentNew cChunkStay class for temporarily keeping chunks loaded even when then have no clients. For now unused, will be used by generator and lighting in the future. (diff)
downloadcuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar.gz
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar.bz2
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar.lz
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar.xz
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.tar.zst
cuberite-1f88db187bbc1bacc29a2f263c73ff383aa06e91.zip
Diffstat (limited to 'source/WorldStorage.h')
-rw-r--r--source/WorldStorage.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/WorldStorage.h b/source/WorldStorage.h
index 1ea39cf66..9c3a38771 100644
--- a/source/WorldStorage.h
+++ b/source/WorldStorage.h
@@ -97,10 +97,10 @@ public:
cWorldStorage(void);
~cWorldStorage();
- void QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Queues the chunk for loading; if not loaded, the chunk will be generated
+ void QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate); // Queues the chunk for loading; if not loaded, the chunk will be generated if a_Generate is true
void QueueSaveChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
- void UnqueueLoad(const cChunkCoords & a_Chunk);
+ void UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
void UnqueueSave(const cChunkCoords & a_Chunk);
bool Start(cWorld * a_World, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args
@@ -112,12 +112,24 @@ public:
protected:
+ struct sChunkLoad
+ {
+ int m_ChunkX;
+ int m_ChunkY;
+ int m_ChunkZ;
+ bool m_Generate; // If true, the chunk will be generated if it cannot be loaded
+
+ sChunkLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ), m_Generate(a_Generate) {}
+ } ;
+
+ typedef std::list<sChunkLoad> sChunkLoadQueue;
+
cWorld * m_World;
AString m_StorageSchemaName;
// Both queues are locked by the same CS
cCriticalSection m_CSQueues;
- cChunkCoordsList m_LoadQueue;
+ sChunkLoadQueue m_LoadQueue;
cChunkCoordsList m_SaveQueue;
cEvent m_Event; // Set when there's any addition to the queues