summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-06 18:41:48 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-06 18:41:48 +0100
commit3acdf25b058bceef3005eead6e909c27c7a9e4a8 (patch)
tree38c40774061bd44b3452091092a018c53459907b /src/Mobs
parentTools: Removed unused Timer.* file from CMakeLists.txt. (diff)
parentMerge pull request #1647 from mc-server/SocketThreadsFix (diff)
downloadcuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar.gz
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar.bz2
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar.lz
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar.xz
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.tar.zst
cuberite-3acdf25b058bceef3005eead6e909c27c7a9e4a8.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/AggressiveMonster.cpp2
-rw-r--r--src/Mobs/Blaze.cpp2
-rw-r--r--src/Mobs/Ghast.cpp2
-rw-r--r--src/Mobs/Monster.cpp27
-rw-r--r--src/Mobs/Skeleton.cpp2
-rw-r--r--src/Mobs/SnowGolem.cpp2
6 files changed, 28 insertions, 9 deletions
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/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/Monster.cpp b/src/Mobs/Monster.cpp
index a1122fb31..7b8f763af 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -266,7 +266,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);
@@ -1027,22 +1029,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());
+ }
}
}
@@ -1055,7 +1069,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());
+ }
}
}
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);
}