From 27185dd3748b04af35a3d17eb5c2c58e826cd9cb Mon Sep 17 00:00:00 2001 From: p-mcgowan Date: Wed, 3 Dec 2014 00:26:15 -0800 Subject: clearing CheckBasicStyle.lua messages --- src/Mobs/Pig.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index 50b69e44f..1e4c35acd 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -49,17 +49,17 @@ void cPig::OnRightClicked(cPlayer & a_Player) a_Player.Detach(); return; } - + if (m_Attachee->IsPlayer()) { // Another player is already sitting in here, cannot attach return; } - + // Detach whatever is sitting in this pig now: m_Attachee->Detach(); } - + // Attach the player to this pig a_Player.AttachTo(this); } @@ -100,7 +100,7 @@ void cPig::Tick(float a_Dt, cChunk & a_Chunk) bool cPig::DoTakeDamage(TakeDamageInfo & a_TDI) -{ +{ if (!super::DoTakeDamage(a_TDI)) { return false; -- cgit v1.2.3 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/Mobs/Blaze.cpp | 2 +- src/Mobs/Ghast.cpp | 2 +- src/Mobs/Skeleton.cpp | 2 +- src/Mobs/SnowGolem.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp index 16869c79d..1fa9d2c37 100644 --- a/src/Mobs/Blaze.cpp +++ b/src/Mobs/Blaze.cpp @@ -34,7 +34,7 @@ void cBlaze::Attack(float a_Dt) { m_AttackInterval += a_Dt * m_AttackRate; - if (m_Target != nullptr && m_AttackInterval > 3.0) + if ((m_Target != nullptr) && (m_AttackInterval > 3.0)) { // Setting this higher gives us more wiggle room for attackrate Vector3d Speed = GetLookVector() * 20; diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index c65c0d29a..fc8de8362 100644 --- a/src/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp @@ -36,7 +36,7 @@ void cGhast::Attack(float a_Dt) { m_AttackInterval += a_Dt * m_AttackRate; - if (m_Target != nullptr && m_AttackInterval > 3.0) + if ((m_Target != nullptr) && (m_AttackInterval > 3.0)) { // Setting this higher gives us more wiggle room for attackrate Vector3d Speed = GetLookVector() * 20; diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index f17bc307c..da5ddc670 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -71,7 +71,7 @@ void cSkeleton::Attack(float a_Dt) { m_AttackInterval += a_Dt * m_AttackRate; - if (m_Target != nullptr && m_AttackInterval > 3.0) + if ((m_Target != nullptr) && (m_AttackInterval > 3.0)) { // Setting this higher gives us more wiggle room for attackrate Vector3d Speed = GetLookVector() * 20; diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp index 76334d970..8c4178beb 100644 --- a/src/Mobs/SnowGolem.cpp +++ b/src/Mobs/SnowGolem.cpp @@ -38,7 +38,7 @@ void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk) { BLOCKTYPE BlockBelow = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()) - 1, (int) floor(GetPosZ())); BLOCKTYPE Block = m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ())); - if (Block == E_BLOCK_AIR && cBlockInfo::IsSolid(BlockBelow)) + if ((Block == E_BLOCK_AIR) && cBlockInfo::IsSolid(BlockBelow)) { m_World->SetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ()), E_BLOCK_SNOW, 0); } -- 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/Mobs/AggressiveMonster.cpp | 2 ++ src/Mobs/Monster.cpp | 27 ++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index 41ef26e2a..7ca7a9d66 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp @@ -75,7 +75,9 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk) } if (m_Target == nullptr) + { return; + } cTracer LineOfSight(GetWorld()); Vector3d AttackDirection(m_Target->GetPosition() - GetPosition()); diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index b8926e31d..c8b2ed774 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -267,7 +267,9 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk) } if ((m_Target != nullptr) && m_Target->IsDestroyed()) + { m_Target = nullptr; + } // Burning in daylight HandleDaylightBurning(a_Chunk); @@ -1028,22 +1030,34 @@ void cMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel) MTRand r1; if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2))) { - if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet()); + if (!GetEquippedHelmet().IsEmpty()) + { + a_Drops.push_back(GetEquippedHelmet()); + } } if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2))) { - if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate()); + if (!GetEquippedChestplate().IsEmpty()) + { + a_Drops.push_back(GetEquippedChestplate()); + } } if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2))) { - if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings()); + if (!GetEquippedLeggings().IsEmpty()) + { + a_Drops.push_back(GetEquippedLeggings()); + } } if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2))) { - if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots()); + if (!GetEquippedBoots().IsEmpty()) + { + a_Drops.push_back(GetEquippedBoots()); + } } } @@ -1056,7 +1070,10 @@ void cMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel) MTRand r1; if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2))) { - if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon()); + if (!GetEquippedWeapon().IsEmpty()) + { + a_Drops.push_back(GetEquippedWeapon()); + } } } -- cgit v1.2.3