From 5ef6c8fe72f96dec20e2305ba190759c17512861 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Thu, 22 May 2014 10:54:07 +0200 Subject: Both SetSpeed functions are now overridden by cPlayer --- src/Entities/Player.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Entities/Player.cpp') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c3b763278..48320b6c9 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1252,6 +1252,26 @@ 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); + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + +void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) +{ + m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + void cPlayer::MoveTo( const Vector3d & a_NewPos ) { if ((a_NewPos.y < -990) && (GetPosY() > -100)) -- cgit v1.2.3 From 73455d293861c492388f3a28af3380318eaa0bae Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Thu, 22 May 2014 11:08:44 +0200 Subject: cPlayer overrides the SetSpeedXX functions Fixed compile error --- src/Entities/Player.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/Entities/Player.cpp') 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); } -- cgit v1.2.3 From 3f009a7c9e35a08d5685cd4276e17fc8f3443f9e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 14 Jun 2014 17:10:53 +0200 Subject: Refactored speed-setting to use a common function for all cases. --- src/Entities/Player.cpp | 58 ++----------------------------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) (limited to 'src/Entities/Player.cpp') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 33b339f8e..f1e0aad7e 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1257,30 +1257,15 @@ Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const void cPlayer::ForceSetSpeed(const Vector3d & a_Speed) { SetSpeed(a_Speed); - m_ClientHandle->SendEntityVelocity(*this); -} - - - - - -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); } -void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) +void cPlayer::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) { - m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); - WrapSpeed(); + super::DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ); // Send the speed to the client so he actualy moves m_ClientHandle->SendEntityVelocity(*this); @@ -1290,45 +1275,6 @@ void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) -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); -} - - - - - void cPlayer::MoveTo( const Vector3d & a_NewPos ) { if ((a_NewPos.y < -990) && (GetPosY() > -100)) -- cgit v1.2.3