summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-05 21:49:07 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-05 21:49:07 +0100
commit06dc6ae071c5737093b62d59725d99e26b5dabfc (patch)
tree3c1ac4ec6277fa23d4c719d4927eb531aaa9891d /source
parentMade ListenThread an OSSupport part, as it's generic enough (diff)
downloadcuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar.gz
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar.bz2
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar.lz
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar.xz
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.tar.zst
cuberite-06dc6ae071c5737093b62d59725d99e26b5dabfc.zip
Diffstat (limited to 'source')
-rw-r--r--source/Player.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index e84eee899..4942db10c 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -558,13 +558,18 @@ void cPlayer::TeleportTo(double a_PosX, double a_PosY, double a_PosZ)
void cPlayer::MoveTo( const Vector3d & a_NewPos )
{
- if (m_AttachedTo != NULL)
+ if ((a_NewPos.y < -990) && (m_Pos.y > -100))
{
// When attached to an entity, the client sends position packets with weird coords:
// Y = -999 and X, Z = attempting to create speed, usually up to 0.03
- Vector3d AddSpeed(a_NewPos);
- AddSpeed.y = 0;
- m_AttachedTo->AddSpeed(AddSpeed);
+ // We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while
+ // the client may still send more of these nonsensical packets.
+ if (m_AttachedTo != NULL)
+ {
+ Vector3d AddSpeed(a_NewPos);
+ AddSpeed.y = 0;
+ m_AttachedTo->AddSpeed(AddSpeed);
+ }
return;
}