summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-21 23:49:06 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-21 23:49:06 +0200
commit8050a5b98a3003c2a4bed39b896b4a3a4c1068c0 (patch)
treebb0be233efcf1052125862812569ce3874b4d9d0 /src/Entities/Player.cpp
parentBug and crash fixes (diff)
downloadcuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.gz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.bz2
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.lz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.xz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.zst
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 0b1b4ce5f..1159891cd 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1611,24 +1611,9 @@ void cPlayer::TossItems(const cItems & a_Items)
-bool cPlayer::MoveToWorld(const AString & a_WorldName, cWorld * a_World, bool a_ShouldSendRespawn)
+bool cPlayer::MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
{
- cWorld * World;
- if (a_World == NULL)
- {
- World = cRoot::Get()->GetWorld(a_WorldName);
- if (World == NULL)
- {
- LOG("%s: Couldn't find world \"%s\".", __FUNCTION__, a_WorldName.c_str());
- return false;
- }
- }
- else
- {
- World = a_World;
- }
-
- if (GetWorld() == World)
+ if (GetWorld() == a_World)
{
// Don't move to same world
return false;
@@ -1637,7 +1622,7 @@ bool cPlayer::MoveToWorld(const AString & a_WorldName, cWorld * a_World, bool a_
// Send the respawn packet:
if (a_ShouldSendRespawn && (m_ClientHandle != NULL))
{
- m_ClientHandle->SendRespawn(World->GetDimension());
+ m_ClientHandle->SendRespawn(a_World->GetDimension());
}
// Remove player from the old world
@@ -1645,8 +1630,8 @@ bool cPlayer::MoveToWorld(const AString & a_WorldName, cWorld * a_World, bool a_
GetWorld()->RemovePlayer(this);
// Queue adding player to the new world, including all the necessary adjustments to the object
- World->AddPlayer(this);
- SetWorld(World);
+ a_World->AddPlayer(this);
+ SetWorld(a_World); // Chunks may be streamed before cWorld::AddPlayer() sets the world to the new value
return true;
}