From e223eec1c003b04528805e06dc741ee80e5aad91 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Thu, 31 Mar 2016 18:47:29 +0300 Subject: [PATCH] Player death crashfix --- src/Entities/Player.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c94cec3c9..804a92284 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -108,7 +108,9 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) : SetPosX(World->GetSpawnX()); SetPosY(World->GetSpawnY()); SetPosZ(World->GetSpawnZ()); - SetBedPos(Vector3i(static_cast(World->GetSpawnX()), static_cast(World->GetSpawnY()), static_cast(World->GetSpawnZ()))); + + // This is a new player. Set the player spawn point to the spawn point of the default world + SetBedPos(Vector3i(static_cast(World->GetSpawnX()), static_cast(World->GetSpawnY()), static_cast(World->GetSpawnZ())), World); LOGD("Player \"%s\" is connecting for the first time, spawning at default world spawn {%.2f, %.2f, %.2f}", a_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ() @@ -1990,7 +1992,7 @@ bool cPlayer::SaveToDisk() root["SpawnX"] = GetLastBedPos().x; root["SpawnY"] = GetLastBedPos().y; root["SpawnZ"] = GetLastBedPos().z; - root["SpawnWorld"] = m_SpawnWorld->GetName(); + root["SpawnWorld"] = m_SpawnWorld->GetName(); if (m_World != nullptr) {