diff options
author | archshift <admin@archshift.com> | 2014-04-26 18:21:49 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-04-26 18:25:30 +0200 |
commit | aef2c8ec628aa2522364da1333bc5158e55ac6a2 (patch) | |
tree | da83f950fb33b4910d006499930b98fb231e2fd7 /src/Entities | |
parent | Fixed mobs that don't naturally spawn. (diff) | |
download | cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.gz cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.bz2 cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.lz cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.xz cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.tar.zst cuberite-aef2c8ec628aa2522364da1333bc5158e55ac6a2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Entity.h | 2 | ||||
-rw-r--r-- | src/Entities/FallingBlock.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Minecart.cpp | 34 |
4 files changed, 23 insertions, 17 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 49e7e45e2..961caf493 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -411,7 +411,7 @@ bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType) return true; } } - ASSERT("Invalid damage type!"); + ASSERT(!"Invalid damage type!"); } diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index db40f12ed..9b8011b55 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -270,7 +270,7 @@ public: /// Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items virtual int GetRawDamageAgainst(const cEntity & a_Receiver); - // Returns whether armor will protect against the passed damage type + /** Returns whether armor will protect against the passed damage type **/ virtual bool ArmorCoversAgainst(eDamageType a_DamageType); /// Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp index f48fb156b..50140de67 100644 --- a/src/Entities/FallingBlock.cpp +++ b/src/Entities/FallingBlock.cpp @@ -88,7 +88,7 @@ void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk) AddPosition(GetSpeed() * MilliDt); //If not static (One billionth precision) broadcast movement. - float epsilon = 0.000000001; + static const float epsilon = 0.000000001; if ((fabs(GetSpeedX()) > epsilon) || (fabs(GetSpeedZ()) > epsilon)) { BroadcastMovementUpdate(); diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index ceaa713bb..db55eb058 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -234,15 +234,18 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt) bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); if (EntCol || BlckCol) return; - if (GetSpeedZ() > 0) - { - // Going SOUTH, slow down - AddSpeedZ(-0.1); - } - else if (GetSpeedZ() < 0) + if (GetSpeedZ() != 0) // Don't do anything if cart is stationary { - // Going NORTH, slow down - AddSpeedZ(0.1); + if (GetSpeedZ() > 0) + { + // Going SOUTH, slow down + AddSpeedZ(-0.1); + } + else + { + // Going NORTH, slow down + AddSpeedZ(0.1); + } } break; } @@ -256,13 +259,16 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt) bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); if (EntCol || BlckCol) return; - if (GetSpeedX() > 0) - { - AddSpeedX(-0.1); - } - else if (GetSpeedX() < 0) + if (GetSpeedX() != 0) { - AddSpeedX(0.1); + if (GetSpeedX() > 0) + { + AddSpeedX(-0.1); + } + else + { + AddSpeedX(0.1); + } } break; } |