1
0

Fixed a couple more warnings.

This commit is contained in:
archshift 2014-04-25 17:15:12 -07:00
parent 2c0bb7b717
commit 73edd2b961
2 changed files with 17 additions and 21 deletions

View File

@ -87,7 +87,9 @@ void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk)
AddSpeedY(MilliDt * -9.8f); AddSpeedY(MilliDt * -9.8f);
AddPosition(GetSpeed() * MilliDt); AddPosition(GetSpeed() * MilliDt);
if ((GetSpeedX() != 0) || (GetSpeedZ() != 0)) //If not static (One billionth precision) broadcast movement.
float epsilon = 0.000000001;
if ((fabs(GetSpeedX()) > epsilon) || (fabs(GetSpeedZ()) > epsilon))
{ {
BroadcastMovementUpdate(); BroadcastMovementUpdate();
} }

View File

@ -234,18 +234,15 @@ 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() > 0)
{ {
if (GetSpeedZ() > 0) // Going SOUTH, slow down
{ AddSpeedZ(-0.1);
// Going SOUTH, slow down }
AddSpeedZ(-0.1); else if (GetSpeedZ() < 0)
} {
else // Going NORTH, slow down
{ AddSpeedZ(0.1);
// Going NORTH, slow down
AddSpeedZ(0.1);
}
} }
break; break;
} }
@ -259,16 +256,13 @@ 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 (GetSpeedX() != 0) if (GetSpeedX() > 0)
{ {
if (GetSpeedX() > 0) AddSpeedX(-0.1);
{ }
AddSpeedX(-0.1); else if (GetSpeedX() < 0)
} {
else AddSpeedX(0.1);
{
AddSpeedX(0.1);
}
} }
break; break;
} }