Some Entity.cpp style improvements
This commit is contained in:
parent
33cc1f2a50
commit
4238b0ebe8
@ -255,8 +255,7 @@ void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_R
|
|||||||
|
|
||||||
void cEntity::SetYawFromSpeed(void)
|
void cEntity::SetYawFromSpeed(void)
|
||||||
{
|
{
|
||||||
const double EPS = 0.0000001;
|
if ((abs(m_Speed.x) < std::numeric_limits<double>::epsilon()) && (abs(m_Speed.z) < std::numeric_limits<double>::epsilon()))
|
||||||
if ((abs(m_Speed.x) < EPS) && (abs(m_Speed.z) < EPS))
|
|
||||||
{
|
{
|
||||||
// atan2() may overflow or is undefined, pick any number
|
// atan2() may overflow or is undefined, pick any number
|
||||||
SetYaw(0);
|
SetYaw(0);
|
||||||
@ -1236,7 +1235,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
|
|||||||
if (GetWorld()->GetWorldAge() % 2 == 0)
|
if (GetWorld()->GetWorldAge() % 2 == 0)
|
||||||
{
|
{
|
||||||
double SpeedSqr = GetSpeed().SqrLength();
|
double SpeedSqr = GetSpeed().SqrLength();
|
||||||
if (SpeedSqr == 0.0)
|
if (SpeedSqr < std::numeric_limits<double>::epsilon())
|
||||||
{
|
{
|
||||||
// Speed is zero, send this to clients once only as well as an absolute position
|
// Speed is zero, send this to clients once only as well as an absolute position
|
||||||
if (!m_bHasSentNoSpeed)
|
if (!m_bHasSentNoSpeed)
|
||||||
@ -1477,7 +1476,6 @@ void cEntity::SetWidth(double a_Width)
|
|||||||
void cEntity::AddPosX(double a_AddPosX)
|
void cEntity::AddPosX(double a_AddPosX)
|
||||||
{
|
{
|
||||||
m_Pos.x += a_AddPosX;
|
m_Pos.x += a_AddPosX;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1486,7 +1484,6 @@ void cEntity::AddPosX(double a_AddPosX)
|
|||||||
void cEntity::AddPosY(double a_AddPosY)
|
void cEntity::AddPosY(double a_AddPosY)
|
||||||
{
|
{
|
||||||
m_Pos.y += a_AddPosY;
|
m_Pos.y += a_AddPosY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1495,7 +1492,6 @@ void cEntity::AddPosY(double a_AddPosY)
|
|||||||
void cEntity::AddPosZ(double a_AddPosZ)
|
void cEntity::AddPosZ(double a_AddPosZ)
|
||||||
{
|
{
|
||||||
m_Pos.z += a_AddPosZ;
|
m_Pos.z += a_AddPosZ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1506,7 +1502,6 @@ void cEntity::AddPosition(double a_AddPosX, double a_AddPosY, double a_AddPosZ)
|
|||||||
m_Pos.x += a_AddPosX;
|
m_Pos.x += a_AddPosX;
|
||||||
m_Pos.y += a_AddPosY;
|
m_Pos.y += a_AddPosY;
|
||||||
m_Pos.z += a_AddPosZ;
|
m_Pos.z += a_AddPosZ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user