summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-08 11:06:14 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-08 11:17:10 +0100
commit3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56 (patch)
tree398522505d124f696735b07c82701b0829110158 /src/Entities/Entity.cpp
parentMerge pull request #2961 from LogicParrot/enforce (diff)
downloadcuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar.gz
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar.bz2
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar.lz
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar.xz
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.tar.zst
cuberite-3efdfca61d2fbfb8e5cb5fb1f5b30ca27fe1cf56.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index b207e79c9..d0540b4eb 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1392,7 +1392,8 @@ bool cEntity::DetectPortal()
TargetPos.x *= 8.0;
TargetPos.z *= 8.0;
- cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName(), dimNether, GetWorld()->GetName(), true);
+ cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedOverworldName());
+ ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
LOGD("Jumping nether -> overworld");
new cNetherPortalScanner(this, TargetWorld, TargetPos, 256);
return true;
@@ -1416,7 +1417,8 @@ bool cEntity::DetectPortal()
TargetPos.x /= 8.0;
TargetPos.z /= 8.0;
- cWorld * TargetWorld = cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedNetherWorldName(), dimNether, GetWorld()->GetName(), true);
+ cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedNetherWorldName());
+ ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
LOGD("Jumping overworld -> nether");
new cNetherPortalScanner(this, TargetWorld, TargetPos, 128);
return true;
@@ -1446,7 +1448,9 @@ bool cEntity::DetectPortal()
Player->GetClientHandle()->SendRespawn(dimOverworld);
}
- return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false);
+ cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedOverworldName());
+ ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
+ return MoveToWorld(TargetWorld, false);
}
else
{
@@ -1463,7 +1467,9 @@ bool cEntity::DetectPortal()
reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(dimEnd);
}
- return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedEndWorldName(), dimEnd, GetWorld()->GetName()), false);
+ cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedEndWorldName());
+ ASSERT(TargetWorld != nullptr); // The linkage checker should have prevented this at startup. See cWorld::start()
+ return MoveToWorld(TargetWorld, false);
}
}