summaryrefslogtreecommitdiffstats
path: root/source/ChunkSender.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-06 15:52:44 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-06 15:52:44 +0100
commit8cdd63f06c692f117088909ea5c9b950bba34376 (patch)
treef07924d43ede604c6a5fe30df5914c68a8f7f1dc /source/ChunkSender.h
parentFixed bug FS#157 http://mc-server.org/support/index.php?do=details&task_id=157 (diff)
downloadcuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar.gz
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar.bz2
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar.lz
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar.xz
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.tar.zst
cuberite-8cdd63f06c692f117088909ea5c9b950bba34376.zip
Diffstat (limited to '')
-rw-r--r--source/ChunkSender.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/ChunkSender.h b/source/ChunkSender.h
index a56e797da..e61c45d1e 100644
--- a/source/ChunkSender.h
+++ b/source/ChunkSender.h
@@ -18,6 +18,7 @@
class cWorld;
+class cClientHandle;
@@ -34,14 +35,40 @@ public:
bool Start(cWorld * a_World);
+ /// Notifies that a chunk has become ready and it should be sent to all its clients
void ChunkReady(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
+ /// Queues a chunk to be sent to a specific client
+ void QueueSendChunkTo(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client);
+
+ /// Removes the a_Client from all waiting chunk send operations
+ void RemoveClient(cClientHandle * a_Client);
+
protected:
+ /// Used for sending chunks to specific clients
+ struct sSendChunk
+ {
+ int m_ChunkX;
+ int m_ChunkY;
+ int m_ChunkZ;
+ cClientHandle * m_Client;
+
+ sSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client) :
+ m_ChunkX(a_ChunkX),
+ m_ChunkY(a_ChunkY),
+ m_ChunkZ(a_ChunkZ),
+ m_Client(a_Client)
+ {
+ }
+ };
+ typedef std::list<sSendChunk> sSendChunkList;
+
cWorld * m_World;
cCriticalSection m_CS;
cChunkCoordsList m_ChunksReady;
+ sSendChunkList m_SendChunks;
cEvent m_Event; // Set when anything is added to m_ChunksReady
// Data about the chunk that is being sent:
@@ -56,6 +83,8 @@ protected:
virtual void Entity(cEntity * a_Entity) override;
virtual void BlockEntity(cBlockEntity * a_Entity) override;
+ /// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == NULL
+ void SendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client);
} ;