From cc2d719c59446804f59a956b98fe9f7702da7515 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Tue, 22 Aug 2017 13:34:43 +0100 Subject: Potential spawn prepare fix (#3924) --- src/SpawnPrepare.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/SpawnPrepare.h') diff --git a/src/SpawnPrepare.h b/src/SpawnPrepare.h index 6d001b5f7..62daf1f84 100644 --- a/src/SpawnPrepare.h +++ b/src/SpawnPrepare.h @@ -6,10 +6,15 @@ class cWorld; /** Generates and lights the spawn area of the world. Runs as a separate thread. */ -class cSpawnPrepare +class cSpawnPrepare: + public std::enable_shared_from_this { - + /** Private tag allows public constructors that can only be used with private access. */ + struct sMakeSharedTag {}; public: + + cSpawnPrepare(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance, int a_FirstIdx, sMakeSharedTag); + static void PrepareChunks(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance); protected: @@ -36,8 +41,6 @@ protected: /** Number of chunks prepared when the last progress report was emitted. */ int m_LastReportChunkCount; - cSpawnPrepare(cWorld & a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance, int a_FirstIdx); - void PreparedChunkCallback(int a_ChunkX, int a_ChunkZ); /** Decodes the index into chunk coords. Provides the specific chunk ordering. */ -- cgit v1.2.3