diff options
author | Mattes D <github@xoft.cz> | 2015-06-01 15:02:42 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-06-01 15:02:42 +0200 |
commit | a54fa15bc6326d5482fae27b5fbcd42c8a34427a (patch) | |
tree | 5b2bb45d000c25554b45cdd1aeea59a96734534a /src/ChunkSender.cpp | |
parent | Merge pull request #2178 from jammet/patch-7 (diff) | |
parent | Made cLightingThread own its callbacks (diff) | |
download | cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar.gz cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar.bz2 cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar.lz cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar.xz cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.tar.zst cuberite-a54fa15bc6326d5482fae27b5fbcd42c8a34427a.zip |
Diffstat (limited to 'src/ChunkSender.cpp')
-rw-r--r-- | src/ChunkSender.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index 70b2e9101..2f18ea75c 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -21,10 +21,21 @@ //////////////////////////////////////////////////////////////////////////////// // cNotifyChunkSender: -void cNotifyChunkSender::Call(int a_ChunkX, int a_ChunkZ) + +/// Callback that can be used to notify chunk sender upon another chunkcoord notification +class cNotifyChunkSender : + public cChunkCoordCallback { - m_ChunkSender->ChunkReady(a_ChunkX, a_ChunkZ); -} + virtual void Call(int a_ChunkX, int a_ChunkZ) override + { + m_ChunkSender->ChunkReady(a_ChunkX, a_ChunkZ); + } + + cChunkSender * m_ChunkSender; +public: + cNotifyChunkSender(cChunkSender * a_ChunkSender) : m_ChunkSender(a_ChunkSender) {} +}; + @@ -36,10 +47,8 @@ void cNotifyChunkSender::Call(int a_ChunkX, int a_ChunkZ) cChunkSender::cChunkSender(void) : super("ChunkSender"), m_World(nullptr), - m_RemoveCount(0), - m_Notify(nullptr) + m_RemoveCount(0) { - m_Notify.SetChunkSender(this); } @@ -272,7 +281,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Clien // If the chunk is not lighted, queue it for relighting and get notified when it's ready: if (!m_World->IsChunkLighted(a_ChunkX, a_ChunkZ)) { - m_World->QueueLightChunk(a_ChunkX, a_ChunkZ, &m_Notify); + m_World->QueueLightChunk(a_ChunkX, a_ChunkZ, cpp14::make_unique<cNotifyChunkSender>(this)); return; } |