summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Bindings/DeprecatedBindings.cpp14
-rw-r--r--src/Bindings/PluginManager.cpp9
-rw-r--r--src/Blocks/BlockBed.h5
-rw-r--r--src/Blocks/BlockDoor.cpp10
-rw-r--r--src/Blocks/BlockRail.h88
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/Entities/Entity.cpp20
-rw-r--r--src/Entities/Minecart.cpp29
-rw-r--r--src/Generating/Caves.cpp10
-rw-r--r--src/Mobs/AggressiveMonster.cpp2
-rw-r--r--src/Mobs/Monster.cpp27
-rw-r--r--src/OSSupport/Thread.cpp11
-rw-r--r--src/Simulator/FluidSimulator.cpp2
-rw-r--r--src/StringUtils.cpp10
-rw-r--r--src/Tracer.cpp15
-rw-r--r--src/WorldStorage/WSSAnvil.cpp31
-rw-r--r--src/XMLParser.h8
17 files changed, 241 insertions, 54 deletions
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp
index 95cd9c4f7..6dd6a4e59 100644
--- a/src/Bindings/DeprecatedBindings.cpp
+++ b/src/Bindings/DeprecatedBindings.cpp
@@ -52,7 +52,9 @@ static int tolua_get_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -78,7 +80,9 @@ static int tolua_get_AllToLua_g_BlockTransparent(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -104,7 +108,9 @@ static int tolua_get_AllToLua_g_BlockOneHitDig(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -130,7 +136,9 @@ static int tolua_get_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -156,7 +164,9 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -182,7 +192,9 @@ static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -208,7 +220,9 @@ static int tolua_get_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ {
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
+ }
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index f951f6221..406a540f4 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -1459,11 +1459,16 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer & a_Player,
-cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin) const
+cPlugin * cPluginManager::GetPlugin(const AString & a_Plugin) const
{
for (PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr)
{
- if (itr->second == nullptr) continue;
+ if (itr->second == nullptr)
+ {
+ // The plugin is currently unloaded
+ continue;
+ }
+
if (itr->second->GetName().compare(a_Plugin) == 0)
{
return itr->second;
diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h
index 9fd45644b..a8b5be899 100644
--- a/src/Blocks/BlockBed.h
+++ b/src/Blocks/BlockBed.h
@@ -52,7 +52,10 @@ public:
static NIBBLETYPE RotationToMetaData(double a_Rotation)
{
a_Rotation += 180 + (180 / 4); // So its not aligned with axis
- if (a_Rotation > 360) a_Rotation -= 360;
+ if (a_Rotation > 360)
+ {
+ a_Rotation -= 360;
+ }
a_Rotation = (a_Rotation / 360) * 4;
diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp
index 96345a2df..90b7b15c2 100644
--- a/src/Blocks/BlockDoor.cpp
+++ b/src/Blocks/BlockDoor.cpp
@@ -145,7 +145,10 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
// in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time,
// so the function can only see either the hinge position or orientation, but not both, at any given time. The class itself
// needs extra datamembers.
- if (a_Meta & 0x08) return a_Meta;
+ if (a_Meta & 0x08)
+ {
+ return a_Meta;
+ }
// Holds open/closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C;
@@ -173,7 +176,10 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
// so the function can only see either the hinge position or orientation, but not both, at any given time.The class itself
// needs extra datamembers.
- if (a_Meta & 0x08) return a_Meta;
+ if (a_Meta & 0x08)
+ {
+ return a_Meta;
+ }
// Holds open/closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C;
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index 87ce069ab..21a34d8ce 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -151,13 +151,21 @@ public:
Neighbors[6] = (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_NONE));
Neighbors[7] = (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_SOUTH, E_PURE_NONE));
if (IsUnstable(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_EAST))
+ {
Neighbors[0] = true;
+ }
if (IsUnstable(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_WEST))
+ {
Neighbors[1] = true;
+ }
if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NORTH))
+ {
Neighbors[2] = true;
+ }
if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_SOUTH))
+ {
Neighbors[3] = true;
+ }
for (int i = 0; i < 8; i++)
{
if (Neighbors[i])
@@ -167,12 +175,30 @@ public:
}
if (RailsCnt == 1)
{
- if (Neighbors[7]) return E_META_RAIL_ASCEND_ZP;
- else if (Neighbors[6]) return E_META_RAIL_ASCEND_ZM;
- else if (Neighbors[5]) return E_META_RAIL_ASCEND_XM;
- else if (Neighbors[4]) return E_META_RAIL_ASCEND_XP;
- else if (Neighbors[0] || Neighbors[1]) return E_META_RAIL_XM_XP;
- else if (Neighbors[2] || Neighbors[3]) return E_META_RAIL_ZM_ZP;
+ if (Neighbors[7])
+ {
+ return E_META_RAIL_ASCEND_ZP;
+ }
+ else if (Neighbors[6])
+ {
+ return E_META_RAIL_ASCEND_ZM;
+ }
+ else if (Neighbors[5])
+ {
+ return E_META_RAIL_ASCEND_XM;
+ }
+ else if (Neighbors[4])
+ {
+ return E_META_RAIL_ASCEND_XP;
+ }
+ else if (Neighbors[0] || Neighbors[1])
+ {
+ return E_META_RAIL_XM_XP;
+ }
+ else if (Neighbors[2] || Neighbors[3])
+ {
+ return E_META_RAIL_ZM_ZP;
+ }
ASSERT(!"Weird neighbor count");
return Meta;
}
@@ -185,16 +211,46 @@ public:
}
if (RailsCnt > 1)
{
- if (Neighbors[3] && Neighbors[0] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZP_XP;
- else if (Neighbors[3] && Neighbors[1] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZP_XM;
- else if (Neighbors[2] && Neighbors[0] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZM_XP;
- else if (Neighbors[2] && Neighbors[1] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZM_XM;
- else if (Neighbors[7] && Neighbors[2]) return E_META_RAIL_ASCEND_ZP;
- else if (Neighbors[3] && Neighbors[6]) return E_META_RAIL_ASCEND_ZM;
- else if (Neighbors[5] && Neighbors[0]) return E_META_RAIL_ASCEND_XM;
- else if (Neighbors[4] && Neighbors[1]) return E_META_RAIL_ASCEND_XP;
- else if (Neighbors[0] && Neighbors[1]) return E_META_RAIL_XM_XP;
- else if (Neighbors[2] && Neighbors[3]) return E_META_RAIL_ZM_ZP;
+ if (Neighbors[3] && Neighbors[0] && CanThisRailCurve())
+ {
+ return E_META_RAIL_CURVED_ZP_XP;
+ }
+ else if (Neighbors[3] && Neighbors[1] && CanThisRailCurve())
+ {
+ return E_META_RAIL_CURVED_ZP_XM;
+ }
+ else if (Neighbors[2] && Neighbors[0] && CanThisRailCurve())
+ {
+ return E_META_RAIL_CURVED_ZM_XP;
+ }
+ else if (Neighbors[2] && Neighbors[1] && CanThisRailCurve())
+ {
+ return E_META_RAIL_CURVED_ZM_XM;
+ }
+ else if (Neighbors[7] && Neighbors[2])
+ {
+ return E_META_RAIL_ASCEND_ZP;
+ }
+ else if (Neighbors[3] && Neighbors[6])
+ {
+ return E_META_RAIL_ASCEND_ZM;
+ }
+ else if (Neighbors[5] && Neighbors[0])
+ {
+ return E_META_RAIL_ASCEND_XM;
+ }
+ else if (Neighbors[4] && Neighbors[1])
+ {
+ return E_META_RAIL_ASCEND_XP;
+ }
+ else if (Neighbors[0] && Neighbors[1])
+ {
+ return E_META_RAIL_XM_XP;
+ }
+ else if (Neighbors[2] && Neighbors[3])
+ {
+ return E_META_RAIL_ZM_ZP;
+ }
if (CanThisRailCurve())
{
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index a6cbad32a..366f20170 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -199,9 +199,13 @@ void cClientHandle::GenerateOfflineUUID(void)
AString cClientHandle::FormatChatPrefix(bool ShouldAppendChatPrefixes, AString a_ChatPrefixS, AString m_Color1, AString m_Color2)
{
if (ShouldAppendChatPrefixes)
+ {
return Printf("%s[%s] %s", m_Color1.c_str(), a_ChatPrefixS.c_str(), m_Color2.c_str());
+ }
else
+ {
return Printf("%s", m_Color1.c_str());
+ }
}
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)
{
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index fc925a150..e4735cb83 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -692,8 +692,14 @@ static float GetMarbleNoise( float x, float y, float z, cNoise & a_Noise)
float oct1 = (a_Noise.CubicNoise3D(x * 0.1f, y * 0.1f, z * 0.1f)) * 4;
oct1 = oct1 * oct1 * oct1;
- if (oct1 < 0.f) oct1 = PI_2;
- if (oct1 > PI_2) oct1 = PI_2;
+ if (oct1 < 0.f)
+ {
+ oct1 = PI_2;
+ }
+ if (oct1 > PI_2)
+ {
+ oct1 = PI_2;
+ }
return oct1;
}
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());
+ }
}
}
diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp
index faaccce96..6188d5088 100644
--- a/src/OSSupport/Thread.cpp
+++ b/src/OSSupport/Thread.cpp
@@ -83,12 +83,16 @@ cThread::~cThread()
void cThread::Start( bool a_bWaitOnDelete /* = true */)
{
if (a_bWaitOnDelete)
+ {
m_StopEvent = new cEvent();
+ }
#ifndef _WIN32
pthread_t SndThread;
if (pthread_create( &SndThread, NULL, MyThread, this))
+ {
LOGERROR("ERROR: Could not create thread!");
+ }
#else
DWORD ThreadID = 0;
HANDLE hThread = CreateThread(NULL // security
@@ -132,6 +136,11 @@ void *cThread::MyThread( void *a_Param)
ThreadFunction( ThreadParam);
- if (StopEvent) StopEvent->Set();
+ // If the thread was marked as wait-on-delete, signal the event being waited on:
+ if (StopEvent != nullptr)
+ {
+ StopEvent->Set();
+ }
+
return 0;
}
diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp
index a7551d9bc..ecd74ee52 100644
--- a/src/Simulator/FluidSimulator.cpp
+++ b/src/Simulator/FluidSimulator.cpp
@@ -184,7 +184,9 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
}
if (LowestPoint == m_World.GetBlockMeta(a_X, a_Y, a_Z))
+ {
return NONE;
+ }
if (a_X - X > 0)
{
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index fe145521f..5febf5d6c 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -420,7 +420,10 @@ static bool isLegalUTF8(const unsigned char * source, int length)
case 3: if (((a = (*--srcptr)) < 0x80) || (a > 0xbf)) return false;
case 2:
{
- if ((a = (*--srcptr)) > 0xbf) return false;
+ if ((a = (*--srcptr)) > 0xbf)
+ {
+ return false;
+ }
switch (*source)
{
// no fall-through in this inner switch
@@ -523,7 +526,10 @@ are equivalent to the following loop:
{
ch += *source++;
--tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
+ if (tmpBytesToRead)
+ {
+ ch <<= 6;
+ }
} while (tmpBytesToRead > 0);
}
---------------------------------------------------------------------
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index 53884dee8..e604f4a5b 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -39,8 +39,14 @@ cTracer::~cTracer()
float cTracer::SigNum(float a_Num)
{
- if (a_Num < 0.f) return -1.f;
- if (a_Num > 0.f) return 1.f;
+ if (a_Num < 0.f)
+ {
+ return -1.f;
+ }
+ if (a_Num > 0.f)
+ {
+ return 1.f;
+ }
return 0.f;
}
@@ -59,7 +65,10 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction)
step.z = (int) SigNum(dir.z);
// normalize the direction vector
- if (dir.SqrLength() > 0.f) dir.Normalize();
+ if (dir.SqrLength() > 0.f)
+ {
+ dir.Normalize();
+ }
// how far we must move in the ray direction before
// we encounter a new voxel in x-direction
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index ddee5e514..26a9104bc 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1526,7 +1526,10 @@ void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedN
int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "TileID");
int MetaIdx = a_NBT.FindChildByName(a_TagIdx, "Data");
- if ((TypeIdx < 0) || (MetaIdx < 0)) { return; }
+ if ((TypeIdx < 0) || (MetaIdx < 0))
+ {
+ return;
+ }
int Type = a_NBT.GetInt(TypeIdx);
NIBBLETYPE Meta = (NIBBLETYPE)a_NBT.GetByte(MetaIdx);
@@ -2196,11 +2199,13 @@ void cWSSAnvil::LoadGiantFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "Type");
+ int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "Type");
int ColorIdx = a_NBT.FindChildByName(a_TagIdx, "Color");
int StyleIdx = a_NBT.FindChildByName(a_TagIdx, "Style");
-
- if ((TypeIdx < 0) || (ColorIdx < 0) || (StyleIdx < 0)) { return; }
+ if ((TypeIdx < 0) || (ColorIdx < 0) || (StyleIdx < 0))
+ {
+ return;
+ }
int Type = a_NBT.GetInt(TypeIdx);
int Color = a_NBT.GetInt(ColorIdx);
@@ -2390,8 +2395,10 @@ void cWSSAnvil::LoadSilverfishFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "SkeletonType");
-
- if (TypeIdx < 0) { return; }
+ if (TypeIdx < 0)
+ {
+ return;
+ }
bool Type = ((a_NBT.GetByte(TypeIdx) == 1) ? true : false);
@@ -2505,8 +2512,10 @@ void cWSSAnvil::LoadSquidFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "Profession");
-
- if (TypeIdx < 0) { return; }
+ if (TypeIdx < 0)
+ {
+ return;
+ }
int Type = a_NBT.GetInt(TypeIdx);
@@ -2630,8 +2639,10 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int IsVillagerIdx = a_NBT.FindChildByName(a_TagIdx, "IsVillager");
-
- if (IsVillagerIdx < 0) { return; }
+ if (IsVillagerIdx < 0)
+ {
+ return;
+ }
bool IsVillagerZombie = ((a_NBT.GetByte(IsVillagerIdx) == 1) ? true : false);
diff --git a/src/XMLParser.h b/src/XMLParser.h
index dab9699c9..ea341bce6 100644
--- a/src/XMLParser.h
+++ b/src/XMLParser.h
@@ -254,7 +254,9 @@ protected:
XML_SetDefaultHandlerExpand (m_p, fEnable ? DefaultHandler : nullptr);
}
else
+ {
XML_SetDefaultHandler (m_p, fEnable ? DefaultHandler : nullptr);
+ }
}
// @cmember Enable/Disable external entity ref handler
@@ -402,11 +404,17 @@ public:
{
XML_expat_version v = XML_ExpatVersionInfo ();
if (pnMajor)
+ {
*pnMajor = v .major;
+ }
if (pnMinor)
+ {
*pnMinor = v .minor;
+ }
if (pnMicro)
+ {
*pnMicro = v .micro;
+ }
}
// @cmember Get last error string