1
0

Keep players in gmNotSet (#4248)

This allows players game mode to update to the default after portal to another world.
Fixes #4207
This commit is contained in:
changyong guo
2018-07-23 07:35:32 +08:00
committed by peterbell10
parent 3e802932a6
commit 7b0db672d1
7 changed files with 49 additions and 44 deletions

View File

@@ -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)
{
World = cRoot::Get()->GetDefaultWorld();
m_Player->SetPosition(World->GetSpawnX(), World->GetSpawnY(), World->GetSpawnZ());
}
if (m_Player->GetGameMode() == eGameMode_NotSet)
// New player use default world
// Player who can load from disk, use loaded world
if (m_Player->GetWorld() == nullptr)
{
m_Player->LoginSetGameMode(World->GetGameMode());
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);
}
else
{
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;
}