1
0

Merge pull request #1447 from cedeel/patch-2

A few compiler warning fixes
This commit is contained in:
worktycho 2014-09-23 08:15:22 +01:00
commit e3e7bc21f7
5 changed files with 47 additions and 44 deletions

View File

@ -6,7 +6,7 @@ class cRedstonePoweredEntity
{ {
public: public:
virtual ~cRedstonePoweredEntity() {}; virtual ~cRedstonePoweredEntity() {}
/// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate /// Sets the internal redstone power flag to "on" or "off", depending on the parameter. Calls Activate() if appropriate
virtual void SetRedstonePower(bool a_IsPowered) = 0; virtual void SetRedstonePower(bool a_IsPowered) = 0;

View File

@ -342,6 +342,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
a_TDI.FinalDamage += (int)ceil(2.5 * SmiteLevel); a_TDI.FinalDamage += (int)ceil(2.5 * SmiteLevel);
break; break;
} }
default: break;
} }
} }
} }
@ -1015,7 +1016,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if (Tracer.HitNormal.y != 0.f) NextSpeed.y = 0.f; if (Tracer.HitNormal.y != 0.f) NextSpeed.y = 0.f;
if (Tracer.HitNormal.z != 0.f) NextSpeed.z = 0.f; if (Tracer.HitNormal.z != 0.f) NextSpeed.z = 0.f;
if (Tracer.HitNormal.y == 1) // Hit BLOCK_FACE_YP, we are on the ground if (Tracer.HitNormal.y == 1.f) // Hit BLOCK_FACE_YP, we are on the ground
{ {
m_bOnGround = true; m_bOnGround = true;
} }
@ -1960,7 +1961,7 @@ void cEntity::SteerVehicle(float a_Forward, float a_Sideways)
{ {
return; return;
} }
if ((a_Forward != 0) || (a_Sideways != 0)) if ((a_Forward != 0.f) || (a_Sideways != 0.f))
{ {
m_AttachedTo->HandleSpeedFromAttachee(a_Forward, a_Sideways); m_AttachedTo->HandleSpeedFromAttachee(a_Forward, a_Sideways);
} }

View File

@ -96,6 +96,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
base = 1800; base = 1800;
break; break;
} }
default: break;
} }
// If potion is level II, half the duration. If not, stays the same // If potion is level II, half the duration. If not, stays the same

View File

@ -13,6 +13,7 @@
#include "Player.h" #include "Player.h"
#include "../BoundingBox.h" #include "../BoundingBox.h"
#define NO_SPEED 0.0
#define MAX_SPEED 8 #define MAX_SPEED 8
#define MAX_SPEED_NEGATIVE -MAX_SPEED #define MAX_SPEED_NEGATIVE -MAX_SPEED
@ -220,7 +221,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return; if (EntCol || BlckCol) return;
if (GetSpeedZ() != 0) // Don't do anything if cart is stationary if (GetSpeedZ() != NO_SPEED) // Don't do anything if cart is stationary
{ {
if (GetSpeedZ() > 0) if (GetSpeedZ() > 0)
{ {
@ -239,13 +240,13 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
{ {
SetYaw(180); SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55); SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0); SetSpeedY(NO_SPEED);
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return; if (EntCol || BlckCol) return;
if (GetSpeedX() != 0) if (GetSpeedX() != NO_SPEED)
{ {
if (GetSpeedX() > 0) if (GetSpeedX() > 0)
{ {
@ -305,9 +306,9 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
case E_META_RAIL_ASCEND_XM: // ASCEND EAST case E_META_RAIL_ASCEND_XM: // ASCEND EAST
{ {
SetYaw(180); SetYaw(180);
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
if (GetSpeedX() >= 0) if (GetSpeedX() >= NO_SPEED)
{ {
if (GetSpeedX() <= MAX_SPEED) if (GetSpeedX() <= MAX_SPEED)
{ {
@ -424,9 +425,9 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return; if (EntCol || BlckCol) return;
if (GetSpeedZ() != 0) if (GetSpeedZ() != NO_SPEED)
{ {
if (GetSpeedZ() > 0) if (GetSpeedZ() > NO_SPEED)
{ {
AddSpeedZ(AccelDecelSpeed); AddSpeedZ(AccelDecelSpeed);
} }
@ -441,15 +442,15 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
{ {
SetYaw(180); SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55); SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0); SetSpeedY(NO_SPEED);
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return; if (EntCol || BlckCol) return;
if (GetSpeedX() != 0) if (GetSpeedX() != NO_SPEED)
{ {
if (GetSpeedX() > 0) if (GetSpeedX() > NO_SPEED)
{ {
AddSpeedX(AccelDecelSpeed); AddSpeedX(AccelDecelSpeed);
} }
@ -463,9 +464,9 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_XM: // ASCEND EAST case E_META_RAIL_ASCEND_XM: // ASCEND EAST
{ {
SetYaw(180); SetYaw(180);
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
if (GetSpeedX() >= 0) if (GetSpeedX() >= NO_SPEED)
{ {
if (GetSpeedX() <= MAX_SPEED) if (GetSpeedX() <= MAX_SPEED)
{ {
@ -483,9 +484,9 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_XP: // ASCEND WEST case E_META_RAIL_ASCEND_XP: // ASCEND WEST
{ {
SetYaw(180); SetYaw(180);
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
if (GetSpeedX() > 0) if (GetSpeedX() > NO_SPEED)
{ {
AddSpeedX(AccelDecelSpeed); AddSpeedX(AccelDecelSpeed);
SetSpeedY(GetSpeedX()); SetSpeedY(GetSpeedX());
@ -503,9 +504,9 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_ZM: // ASCEND NORTH case E_META_RAIL_ASCEND_ZM: // ASCEND NORTH
{ {
SetYaw(270); SetYaw(270);
SetSpeedX(0); SetSpeedX(NO_SPEED);
if (GetSpeedZ() >= 0) if (GetSpeedZ() >= NO_SPEED)
{ {
if (GetSpeedZ() <= MAX_SPEED) if (GetSpeedZ() <= MAX_SPEED)
{ {
@ -523,9 +524,9 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_ZP: // ASCEND SOUTH case E_META_RAIL_ASCEND_ZP: // ASCEND SOUTH
{ {
SetYaw(270); SetYaw(270);
SetSpeedX(0); SetSpeedX(NO_SPEED);
if (GetSpeedZ() > 0) if (GetSpeedZ() > NO_SPEED)
{ {
AddSpeedZ(AccelDecelSpeed); AddSpeedZ(AccelDecelSpeed);
SetSpeedY(GetSpeedZ()); SetSpeedY(GetSpeedZ());
@ -576,7 +577,7 @@ void cMinecart::SnapToRail(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_XP: case E_META_RAIL_ASCEND_XP:
case E_META_RAIL_XM_XP: case E_META_RAIL_XM_XP:
{ {
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
SetPosZ(floor(GetPosZ()) + 0.5); SetPosZ(floor(GetPosZ()) + 0.5);
break; break;
} }
@ -584,7 +585,7 @@ void cMinecart::SnapToRail(NIBBLETYPE a_RailMeta)
case E_META_RAIL_ASCEND_ZP: case E_META_RAIL_ASCEND_ZP:
case E_META_RAIL_ZM_ZP: case E_META_RAIL_ZM_ZP:
{ {
SetSpeedX(0); SetSpeedX(NO_SPEED);
SetPosX(floor(GetPosX()) + 0.5); SetPosX(floor(GetPosX()) + 0.5);
break; break;
} }
@ -593,12 +594,12 @@ void cMinecart::SnapToRail(NIBBLETYPE a_RailMeta)
{ {
if (GetPosZ() > floor(GetPosZ()) + 0.5) if (GetPosZ() > floor(GetPosZ()) + 0.5)
{ {
if (GetSpeedZ() > 0) if (GetSpeedZ() > NO_SPEED)
{ {
SetSpeedX(-GetSpeedZ() * 0.7); SetSpeedX(-GetSpeedZ() * 0.7);
} }
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
SetPosZ(floor(GetPosZ()) + 0.5); SetPosZ(floor(GetPosZ()) + 0.5);
} }
else if (GetPosX() > floor(GetPosX()) + 0.5) else if (GetPosX() > floor(GetPosX()) + 0.5)
@ -608,82 +609,82 @@ void cMinecart::SnapToRail(NIBBLETYPE a_RailMeta)
SetSpeedZ(-GetSpeedX() * 0.7); SetSpeedZ(-GetSpeedX() * 0.7);
} }
SetSpeedX(0); SetSpeedX(NO_SPEED);
SetPosX(floor(GetPosX()) + 0.5); SetPosX(floor(GetPosX()) + 0.5);
} }
SetSpeedY(0); SetSpeedY(NO_SPEED);
break; break;
} }
case E_META_RAIL_CURVED_ZM_XP: case E_META_RAIL_CURVED_ZM_XP:
{ {
if (GetPosZ() > floor(GetPosZ()) + 0.5) if (GetPosZ() > floor(GetPosZ()) + 0.5)
{ {
if (GetSpeedZ() > 0) if (GetSpeedZ() > NO_SPEED)
{ {
SetSpeedX(GetSpeedZ() * 0.7); SetSpeedX(GetSpeedZ() * 0.7);
} }
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
SetPosZ(floor(GetPosZ()) + 0.5); SetPosZ(floor(GetPosZ()) + 0.5);
} }
else if (GetPosX() < floor(GetPosX()) + 0.5) else if (GetPosX() < floor(GetPosX()) + 0.5)
{ {
if (GetSpeedX() < 0) if (GetSpeedX() < NO_SPEED)
{ {
SetSpeedZ(GetSpeedX() * 0.7); SetSpeedZ(GetSpeedX() * 0.7);
} }
SetSpeedX(0); SetSpeedX(NO_SPEED);
SetPosX(floor(GetPosX()) + 0.5); SetPosX(floor(GetPosX()) + 0.5);
} }
SetSpeedY(0); SetSpeedY(NO_SPEED);
break; break;
} }
case E_META_RAIL_CURVED_ZP_XM: case E_META_RAIL_CURVED_ZP_XM:
{ {
if (GetPosZ() < floor(GetPosZ()) + 0.5) if (GetPosZ() < floor(GetPosZ()) + 0.5)
{ {
if (GetSpeedZ() < 0) if (GetSpeedZ() < NO_SPEED)
{ {
SetSpeedX(GetSpeedZ() * 0.7); SetSpeedX(GetSpeedZ() * 0.7);
} }
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
SetPosZ(floor(GetPosZ()) + 0.5); SetPosZ(floor(GetPosZ()) + 0.5);
} }
else if (GetPosX() > floor(GetPosX()) + 0.5) else if (GetPosX() > floor(GetPosX()) + 0.5)
{ {
if (GetSpeedX() > 0) if (GetSpeedX() > NO_SPEED)
{ {
SetSpeedZ(GetSpeedX() * 0.7); SetSpeedZ(GetSpeedX() * 0.7);
} }
SetSpeedX(0); SetSpeedX(NO_SPEED);
SetPosX(floor(GetPosX()) + 0.5); SetPosX(floor(GetPosX()) + 0.5);
} }
SetSpeedY(0); SetSpeedY(NO_SPEED);
break; break;
} }
case E_META_RAIL_CURVED_ZP_XP: case E_META_RAIL_CURVED_ZP_XP:
{ {
if (GetPosZ() < floor(GetPosZ()) + 0.5) if (GetPosZ() < floor(GetPosZ()) + 0.5)
{ {
if (GetSpeedZ() < 0) if (GetSpeedZ() < NO_SPEED)
{ {
SetSpeedX(-GetSpeedZ() * 0.7); SetSpeedX(-GetSpeedZ() * 0.7);
} }
SetSpeedZ(0); SetSpeedZ(NO_SPEED);
SetPosZ(floor(GetPosZ()) + 0.5); SetPosZ(floor(GetPosZ()) + 0.5);
} }
else if (GetPosX() < floor(GetPosX()) + 0.5) else if (GetPosX() < floor(GetPosX()) + 0.5)
{ {
if (GetSpeedX() < 0) if (GetSpeedX() < NO_SPEED)
{ {
SetSpeedZ(-GetSpeedX() * 0.7); SetSpeedZ(-GetSpeedX() * 0.7);
} }
SetSpeedX(0); SetSpeedX(NO_SPEED);
SetPosX(floor(GetPosX()) + 0.5); SetPosX(floor(GetPosX()) + 0.5);
} }
SetSpeedY(0); SetSpeedY(0);

View File

@ -283,7 +283,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f
if (fabs(D) < EPSILON) if (fabs(D) < EPSILON)
{ {
// segment is parallel to plane // segment is parallel to plane
if (N == 0) if (N == 0.0)
{ {
// segment lies in plane // segment lies in plane
return 2; return 2;