summaryrefslogtreecommitdiffstats
path: root/src/ChunkSender.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-30 12:11:17 +0200
committertycho <work.tycho@gmail.com>2015-05-30 12:11:17 +0200
commit06a74e45e247a2d23c6b5a238a3c1b9b17b6c341 (patch)
tree965c54b25acc4a3b7dee194f9194f885299e5656 /src/ChunkSender.cpp
parentClean up Spawn Prepare (diff)
downloadcuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar.gz
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar.bz2
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar.lz
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar.xz
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.tar.zst
cuberite-06a74e45e247a2d23c6b5a238a3c1b9b17b6c341.zip
Diffstat (limited to 'src/ChunkSender.cpp')
-rw-r--r--src/ChunkSender.cpp23
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;
}