summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/ChunkSender.cpp14
-rw-r--r--source/ChunkSender.h2
-rw-r--r--source/cWorld.cpp1
3 files changed, 15 insertions, 2 deletions
diff --git a/source/ChunkSender.cpp b/source/ChunkSender.cpp
index cb4340f25..f73246c98 100644
--- a/source/ChunkSender.cpp
+++ b/source/ChunkSender.cpp
@@ -30,8 +30,7 @@ cChunkSender::cChunkSender(void) :
cChunkSender::~cChunkSender()
{
- m_ShouldTerminate = true;
- m_evtQueue.Set();
+ Stop();
}
@@ -48,6 +47,17 @@ bool cChunkSender::Start(cWorld * a_World)
+void cChunkSender::Stop(void)
+{
+ m_ShouldTerminate = true;
+ m_evtQueue.Set();
+ Wait();
+}
+
+
+
+
+
void cChunkSender::ChunkReady(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
// This is probably never gonna be called twice for the same chunk, and if it is, we don't mind, so we don't check
diff --git a/source/ChunkSender.h b/source/ChunkSender.h
index 23cce039b..c5c6f7774 100644
--- a/source/ChunkSender.h
+++ b/source/ChunkSender.h
@@ -51,6 +51,8 @@ public:
bool Start(cWorld * a_World);
+ void Stop(void);
+
/// 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);
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 1695a6427..62c952ba1 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -164,6 +164,7 @@ cWorld::~cWorld()
delete m_RedstoneSimulator;
m_Generator.Stop();
+ m_ChunkSender.Stop();
UnloadUnusedChunks();