summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-12-24 16:30:36 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2020-12-26 18:55:45 +0100
commitbb37e5c152963cdc4859ca1ba571c3c53ed98ec3 (patch)
treeec503e7669f9aecffc75b3f2032d93194a1d6a0e
parentDon't prematurely exit "downloading terrain" screen on join (diff)
downloadcuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar.gz
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar.bz2
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar.lz
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar.xz
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.tar.zst
cuberite-bb37e5c152963cdc4859ca1ba571c3c53ed98ec3.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp37
-rw-r--r--src/ClientHandle.h5
2 files changed, 4 insertions, 38 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index f9b4fd327..916de10c7 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -127,7 +127,6 @@ cClientHandle::~cClientHandle()
cWorld * World = m_Player->GetWorld();
if (World != nullptr)
{
- RemoveFromAllChunks();
m_Player->GetWorld()->RemoveClientFromChunkSender(this);
}
// Send the Offline PlayerList packet:
@@ -634,32 +633,6 @@ void cClientHandle::StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::Priori
-void cClientHandle::RemoveFromAllChunks()
-{
- cWorld * World = m_Player->GetWorld();
- if (World != nullptr)
- {
- World->RemoveClientFromChunks(this);
- }
-
- {
- // Reset all chunk lists:
- cCSLock Lock(m_CSChunkLists);
- m_LoadedChunks.clear();
- m_ChunksToSend.clear();
- m_SentChunks.clear();
-
- // Also reset the LastStreamedChunk coords to bogus coords,
- // so that all chunks are streamed in subsequent StreamChunks() call (FS #407)
- m_LastStreamedChunkX = 0x7fffffff;
- m_LastStreamedChunkZ = 0x7fffffff;
- }
-}
-
-
-
-
-
void cClientHandle::HandleNPCTrade(int a_SlotNum)
{
// TODO
@@ -2047,16 +2020,14 @@ void cClientHandle::SendData(const char * a_Data, size_t a_Size)
void cClientHandle::RemoveFromWorld(void)
{
// Remove all associated chunks:
- decltype(m_LoadedChunks) Chunks;
{
cCSLock Lock(m_CSChunkLists);
- std::swap(Chunks, m_LoadedChunks);
+ m_LoadedChunks.clear();
m_ChunksToSend.clear();
+ m_SentChunks.clear();
}
- for (auto && Chunk : Chunks)
- {
- SendUnloadChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ);
- } // for itr - Chunks[]
+
+ // No need to send Unload Chunk packets, the client unloads automatically.
// Here, we set last streamed values to bogus ones so everything is resent
m_LastStreamedChunkX = 0x7fffffff;
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 93864b002..e52236411 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -124,10 +124,6 @@ public: // tolua_export
/** Remove all loaded chunks that are no longer in range */
void UnloadOutOfRangeChunks(void);
- /** Removes the client from all chunks. Used when destroying the player.
- When switching worlds, RemoveFromWorld does this function's job so it isn't called. */
- void RemoveFromAllChunks(void);
-
inline bool IsLoggedIn(void) const { return (m_State >= csAuthenticating); }
/** Called while the client is being ticked from the world via its cPlayer object */
@@ -505,7 +501,6 @@ private:
csAuthenticating, ///< The client has logged in, waiting for external authentication
csAuthenticated, ///< The client has been authenticated, will start streaming chunks in the next tick
csDownloadingWorld, ///< The client is waiting for chunks, we're waiting for the loader to provide and send them
- csConfirmingPos, ///< The client has been sent the position packet, waiting for them to repeat the position back
csPlaying, ///< Normal gameplay
csKicked, ///< Disconnect packet sent, awaiting connection closure
csQueuedForDestruction, ///< The client will be destroyed in the next tick (flag set when socket closed)