From 44644ae0254bf3659c0995575041e2f656f20398 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Dec 2014 12:56:53 +0100 Subject: Fixed reported parentheses around comparisons. --- src/Entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index afc61c73f..3b2fa9b4e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1276,7 +1276,7 @@ bool cEntity::DetectPortal() return false; } - if (IsPlayer() && !((cPlayer *)this)->IsGameModeCreative() && m_PortalCooldownData.m_TicksDelayed != 80) + if (IsPlayer() && !((cPlayer *)this)->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80)) { // Delay teleportation for four seconds if the entity is a non-creative player m_PortalCooldownData.m_TicksDelayed++; -- cgit v1.2.3 From e2a04f580a0813206f527a61244cb3382248fd12 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Dec 2014 16:59:11 +0100 Subject: BasicStyle: Added missing braces to control statements. --- src/Entities/Entity.cpp | 20 ++++++++++++++++---- src/Entities/Minecart.cpp | 29 +++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 10 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 3b2fa9b4e..54b9f2a20 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -665,7 +665,10 @@ int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_Dama // Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover // Filter out damage types that are not protected by armor: - if (!ArmorCoversAgainst(a_DamageType)) return 0; + if (!ArmorCoversAgainst(a_DamageType)) + { + return 0; + } // Add up all armor points: // Ref.: http://www.minecraftwiki.net/wiki/Armor#Defense_points as of 2012_12_20 @@ -1011,9 +1014,18 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) // Block hit was within our projected path // Begin by stopping movement in the direction that we hit something. The Normal is the line perpendicular to a 2D face and in this case, stores what block face was hit through either -1 or 1. // For example: HitNormal.y = -1 : BLOCK_FACE_YM; HitNormal.y = 1 : BLOCK_FACE_YP - if (Tracer.HitNormal.x != 0.f) NextSpeed.x = 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.x != 0.f) + { + NextSpeed.x = 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.y == 1.f) // Hit BLOCK_FACE_YP, we are on the ground { diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 22e046800..fac4f0714 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -142,8 +142,13 @@ void cMinecart::HandlePhysics(float a_Dt, cChunk & a_Chunk) if (!IsBlockRail(InsideType)) { - Chunk->GetBlockTypeMeta(RelPosX, PosY + 1, RelPosZ, InsideType, InsideMeta); // When an descending minecart hits a flat rail, it goes through the ground; check for this - if (IsBlockRail(InsideType)) AddPosY(1); // Push cart upwards + // When a descending minecart hits a flat rail, it goes through the ground; check for this + Chunk->GetBlockTypeMeta(RelPosX, PosY + 1, RelPosZ, InsideType, InsideMeta); + if (IsBlockRail(InsideType)) + { + // Push cart upwards + AddPosY(1); + } } bool WasDetectorRail = false; @@ -218,7 +223,10 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt) // Execute both the entity and block collision checks bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); - if (EntCol || BlckCol) return; + if (EntCol || BlckCol) + { + return; + } if (GetSpeedZ() != NO_SPEED) // Don't do anything if cart is stationary { @@ -243,7 +251,10 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt) SetSpeedZ(NO_SPEED); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); - if (EntCol || BlckCol) return; + if (EntCol || BlckCol) + { + return; + } if (GetSpeedX() != NO_SPEED) { @@ -422,7 +433,10 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta) SetSpeedX(0); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); - if (EntCol || BlckCol) return; + if (EntCol || BlckCol) + { + return; + } if (GetSpeedZ() != NO_SPEED) { @@ -445,7 +459,10 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta) SetSpeedZ(NO_SPEED); bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta); - if (EntCol || BlckCol) return; + if (EntCol || BlckCol) + { + return; + } if (GetSpeedX() != NO_SPEED) { -- cgit v1.2.3