From 7b0db672d1ff72caec1f45cbc0c855680337766d Mon Sep 17 00:00:00 2001 From: changyong guo Date: Mon, 23 Jul 2018 07:35:32 +0800 Subject: Keep players in gmNotSet (#4248) This allows players game mode to update to the default after portal to another world. Fixes #4207 --- src/ClientHandle.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 9ae0b4adc..80819cb61 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -373,16 +373,22 @@ void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_U InvalidateCachedSentChunk(); m_Self.reset(); - World = cRoot::Get()->GetWorld(m_Player->GetLoadedWorldName()); - if (World == nullptr) + + // New player use default world + // Player who can load from disk, use loaded world + if (m_Player->GetWorld() == nullptr) { - World = cRoot::Get()->GetDefaultWorld(); - m_Player->SetPosition(World->GetSpawnX(), World->GetSpawnY(), World->GetSpawnZ()); + World = cRoot::Get()->GetWorld(m_Player->GetLoadedWorldName()); + if (World == nullptr) + { + World = cRoot::Get()->GetDefaultWorld(); + m_Player->SetPosition(World->GetSpawnX(), World->GetSpawnY(), World->GetSpawnZ()); + } + m_Player->SetWorld(World); } - - if (m_Player->GetGameMode() == eGameMode_NotSet) + else { - m_Player->LoginSetGameMode(World->GetGameMode()); + World = m_Player->GetWorld(); } m_Player->SetIP (m_IPString); @@ -425,7 +431,6 @@ void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_U cRoot::Get()->BroadcastPlayerListsAddPlayer(*m_Player); cRoot::Get()->SendPlayerLists(m_Player); - m_Player->SetWorld(World); m_State = csAuthenticated; } -- cgit v1.2.3