diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-05-22 11:08:44 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-05-22 11:08:44 +0200 |
commit | 73455d293861c492388f3a28af3380318eaa0bae (patch) | |
tree | c31ce06aa2d2960d46f1b80c3cc7d8d2ecb4f424 /src/Entities | |
parent | Both SetSpeed functions are now overridden by cPlayer (diff) | |
download | cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar.gz cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar.bz2 cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar.lz cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar.xz cuberite-73455d293861c492388f3a28af3380318eaa0bae.tar.zst cuberite-73455d293861c492388f3a28af3380318eaa0bae.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.h | 6 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 45 | ||||
-rw-r--r-- | src/Entities/Player.h | 6 |
3 files changed, 53 insertions, 4 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0ea27ef10..fc72462c3 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -222,9 +222,9 @@ public: // tolua_begin virtual void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); virtual void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } - void SetSpeedX (double a_SpeedX); - void SetSpeedY (double a_SpeedY); - void SetSpeedZ (double a_SpeedZ); + virtual void SetSpeedX (double a_SpeedX); + virtual void SetSpeedY (double a_SpeedY); + virtual void SetSpeedZ (double a_SpeedZ); void SetWidth (double a_Width); void AddPosX (double a_AddPosX); diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 48320b6c9..0d79ff533 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1255,6 +1255,9 @@ void cPlayer::ForceSetSpeed(const Vector3d & a_Speed) void cPlayer::SetSpeed(const Vector3d & a_Speed) { m_Speed.Set(a_Speed.x, a_Speed.y, a_Speed.z); + WrapSpeed(); + + // Send the speed to the client so he actualy moves m_ClientHandle->SendEntityVelocity(*this); } @@ -1265,6 +1268,48 @@ void cPlayer::SetSpeed(const Vector3d & a_Speed) void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) { m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); + WrapSpeed(); + + // Send the speed to the client so he actualy moves + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + +void cPlayer::SetSpeedX(double a_SpeedX) +{ + m_Speed.x = a_SpeedX; + WrapSpeed(); + + // Send the speed to the client so he actualy moves + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + +void cPlayer::SetSpeedY(double a_SpeedY) +{ + m_Speed.y = a_SpeedY; + WrapSpeed(); + + // Send the speed to the client so he actualy moves + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + +void cPlayer::SetSpeedZ(double a_SpeedZ) +{ + m_Speed.z = a_SpeedZ; + WrapSpeed(); + + // Send the speed to the client so he actualy moves m_ClientHandle->SendEntityVelocity(*this); } diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 43f27e045..fb6bdc3ee 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -195,7 +195,11 @@ public: void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export virtual void SetSpeed(const Vector3d & a_Speed) override; - virtual void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override + virtual void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override; + + virtual void SetSpeedX(double a_SpeedX) override; + virtual void SetSpeedY(double a_SpeedY) override; + virtual void SetSpeedZ(double a_SpeedZ) override; /** Tries to move to a new position, with attachment-related checks (y == -999) */ void MoveTo(const Vector3d & a_NewPos); // tolua_export |