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/Entity.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0c393c0f5..0ea27ef10 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -214,8 +214,14 @@ public: void SetYaw (double a_Yaw); // In degrees, normalizes to [-180, +180) void SetPitch (double a_Pitch); // In degrees, normalizes to [-180, +180) void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180) - void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); - void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } + // tolua_end + + /** Measured in meter/second (m/s) */ + Vector3d m_Speed; + + // 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); @@ -504,9 +510,6 @@ private: /** Measured in degrees, [-180, +180) */ double m_HeadYaw; - /** Measured in meter/second (m/s) */ - Vector3d m_Speed; - /** Measured in degrees, [-180, +180) */ Vector3d m_Rot; -- 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/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.h') 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); -- cgit v1.2.3 From 592a0b6147f359fd9d12a28c9c43c208d84b5b3f Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Thu, 22 May 2014 11:46:38 +0200 Subject: cEntity::SetSpeed(a_Vector3d) isn't virtualized anymore --- src/Entities/Entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index fc72462c3..ed67465a3 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -221,7 +221,7 @@ 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 SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } virtual void SetSpeedX (double a_SpeedX); virtual void SetSpeedY (double a_SpeedY); virtual void SetSpeedZ (double a_SpeedZ); -- cgit v1.2.3 From aa7c82580f2493052d119b1f27d5255c1609aa19 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 10 Jun 2014 23:16:38 -0700 Subject: Player.h: Moved doxy-comments to Entity.h Moved doxy-comments to the defining function in Entity.h rather than the overloaded functions in Player.h Comment for each function (instead of assumed encapsulating comments) @deprecated tag for ForceSetSpeed() --- src/Entities/Entity.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index ed67465a3..ecd26b194 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -220,11 +220,18 @@ public: Vector3d m_Speed; // tolua_begin + /** Sets the speed of the entity and moves them in the given speed. */ virtual void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); + /** Sets the speed of the entity and moves them in the given speed. */ void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } + + /** Sets the speed for the X axis */ virtual void SetSpeedX (double a_SpeedX); + /** Sets the speed for the Y axis */ virtual void SetSpeedY (double a_SpeedY); + /** Sets the speed for the Z axis */ virtual void SetSpeedZ (double a_SpeedZ); + void SetWidth (double a_Width); void AddPosX (double a_AddPosX); -- 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/Entity.h | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index fed856b30..cb35db43b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -217,21 +217,21 @@ public: void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180) // tolua_end - /** Measured in meter/second (m/s) */ - Vector3d m_Speed; - // tolua_begin - /** Sets the speed of the entity and moves them in the given speed. */ - virtual void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); - /** Sets the speed of the entity and moves them in the given speed. */ - void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } - - /** Sets the speed for the X axis */ - virtual void SetSpeedX (double a_SpeedX); - /** Sets the speed for the Y axis */ - virtual void SetSpeedY (double a_SpeedY); - /** Sets the speed for the Z axis */ - virtual void SetSpeedZ (double a_SpeedZ); + /** Sets the speed of the entity, measured in m / sec */ + void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ); + + /** Sets the speed of the entity, measured in m / sec */ + void SetSpeed(const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } + + /** Sets the speed in the X axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedX(double a_SpeedX); + + /** Sets the speed in the Y axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedY(double a_SpeedY); + + /** Sets the speed in the Z axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedZ(double a_SpeedZ); void SetWidth (double a_Width); @@ -442,6 +442,9 @@ protected: static cCriticalSection m_CSCount; static int m_EntityCount; + /** Measured in meter/second (m/s) */ + Vector3d m_Speed; + int m_UniqueID; int m_Health; @@ -499,11 +502,15 @@ protected: /// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. int m_TicksSinceLastVoidDamage; - + + /** Does the actual speed-setting. The default implementation just sets the member variable value; + overrides can provide further processing, such as forcing players to move at the given speed. */ + virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ); + virtual void Destroyed(void) {} // Called after the entity has been destroyed /** Called in each tick to handle air-related processing i.e. drowning */ - virtual void HandleAir(); + virtual void HandleAir(void); /** Called once per tick to set IsSwimming and IsSubmerged */ virtual void SetSwimState(cChunk & a_Chunk); -- cgit v1.2.3 From 493d36433108735553ec073ccfbb563a4468a3fd Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 14 Jun 2014 18:23:27 +0200 Subject: Removed an unused tolua_end and tolua_begin pair. --- src/Entities/Entity.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index cb35db43b..2df66e353 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -215,9 +215,7 @@ public: void SetYaw (double a_Yaw); // In degrees, normalizes to [-180, +180) void SetPitch (double a_Pitch); // In degrees, normalizes to [-180, +180) void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180) - // tolua_end - // tolua_begin /** Sets the speed of the entity, measured in m / sec */ void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ); -- cgit v1.2.3