1
0

cPlayer overrides the SetSpeedXX functions

Fixed compile error
This commit is contained in:
STRWarrior 2014-05-22 11:08:44 +02:00
parent 5ef6c8fe72
commit 73455d2938
3 changed files with 53 additions and 4 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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