summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-05 12:56:53 +0100
committerMattes D <github@xoft.cz>2014-12-05 12:58:47 +0100
commit44644ae0254bf3659c0995575041e2f656f20398 (patch)
tree571528b0f4864c0dab826a4366b9ad40049960be /src
parentMerge pull request #1649 from jonfabe/InfoDumpFix (diff)
downloadcuberite-44644ae0254bf3659c0995575041e2f656f20398.tar
cuberite-44644ae0254bf3659c0995575041e2f656f20398.tar.gz
cuberite-44644ae0254bf3659c0995575041e2f656f20398.tar.bz2
cuberite-44644ae0254bf3659c0995575041e2f656f20398.tar.lz
cuberite-44644ae0254bf3659c0995575041e2f656f20398.tar.xz
cuberite-44644ae0254bf3659c0995575041e2f656f20398.tar.zst
cuberite-44644ae0254bf3659c0995575041e2f656f20398.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp2
-rw-r--r--src/Inventory.cpp8
-rw-r--r--src/MobSpawner.cpp8
-rw-r--r--src/Mobs/Blaze.cpp2
-rw-r--r--src/Mobs/Ghast.cpp2
-rw-r--r--src/Mobs/Skeleton.cpp2
-rw-r--r--src/Mobs/SnowGolem.cpp2
-rw-r--r--src/OSSupport/Socket.h2
-rw-r--r--src/Simulator/FluidSimulator.cpp4
-rw-r--r--src/StringUtils.cpp33
-rw-r--r--src/Tracer.cpp105
-rw-r--r--src/UI/SlotArea.cpp2
-rw-r--r--src/World.cpp4
-rw-r--r--src/XMLParser.h6
14 files changed, 99 insertions, 83 deletions
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++;
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 51ac32da9..fba6f4aea 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -507,7 +507,11 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize();
for (int i = 0; i < a_Size; i++)
{
- if (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage)
+ if (
+ (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType) &&
+ (m_Slots[i + a_Offset].m_ItemCount < MaxStackSize) &&
+ (m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage)
+ )
{
int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount;
if (NumFree >= a_Item.m_ItemCount)
@@ -533,7 +537,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
if (a_Mode > 0)
{
// If we got more left, find first empty slot
- for (int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
+ for (int i = 0; (i < a_Size) && (a_Item.m_ItemCount > 0); i++)
{
if (m_Slots[i + a_Offset].m_ItemType == -1)
{
diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp
index e477e2dac..ee9e569a7 100644
--- a/src/MobSpawner.cpp
+++ b/src/MobSpawner.cpp
@@ -61,7 +61,7 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
{
std::set<eMonsterType> allowedMobs;
- if (a_Biome == biMushroomIsland || a_Biome == biMushroomShore)
+ if ((a_Biome == biMushroomIsland) || (a_Biome == biMushroomShore))
{
addIfAllowed(mtMooshroom, allowedMobs);
}
@@ -84,7 +84,7 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
addIfAllowed(mtCreeper, allowedMobs);
addIfAllowed(mtSquid, allowedMobs);
- if (a_Biome != biDesert && a_Biome != biBeach && a_Biome != biOcean)
+ if ((a_Biome != biDesert) && (a_Biome != biBeach) && (a_Biome != biOcean))
{
addIfAllowed(mtSheep, allowedMobs);
addIfAllowed(mtPig, allowedMobs);
@@ -93,11 +93,11 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
addIfAllowed(mtEnderman, allowedMobs);
addIfAllowed(mtSlime, allowedMobs); // MG TODO : much more complicated rule
- if (a_Biome == biForest || a_Biome == biForestHills || a_Biome == biTaiga || a_Biome == biTaigaHills)
+ if ((a_Biome == biForest) || (a_Biome == biForestHills) || (a_Biome == biTaiga) || (a_Biome == biTaigaHills))
{
addIfAllowed(mtWolf, allowedMobs);
}
- else if (a_Biome == biJungle || a_Biome == biJungleHills)
+ else if ((a_Biome == biJungle) || (a_Biome == biJungleHills))
{
addIfAllowed(mtOcelot, allowedMobs);
}
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);
}
diff --git a/src/OSSupport/Socket.h b/src/OSSupport/Socket.h
index e4ec895cb..9ec8c1111 100644
--- a/src/OSSupport/Socket.h
+++ b/src/OSSupport/Socket.h
@@ -74,7 +74,7 @@ public:
inline static bool IsSocketError(int a_ReturnedValue)
{
#ifdef _WIN32
- return (a_ReturnedValue == SOCKET_ERROR || a_ReturnedValue == 0);
+ return ((a_ReturnedValue == SOCKET_ERROR) || (a_ReturnedValue == 0));
#else
return (a_ReturnedValue <= 0);
#endif
diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp
index 9c8453d04..a7551d9bc 100644
--- a/src/Simulator/FluidSimulator.cpp
+++ b/src/Simulator/FluidSimulator.cpp
@@ -133,8 +133,10 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
/*
Disabled because of causing problems and being useless atm
char BlockBelow = m_World.GetBlock(a_X, a_Y - 1, a_Z); // If there is nothing or fluid below it -> dominating flow is down :D
- if (BlockBelow == E_BLOCK_AIR || IsAllowedBlock(BlockBelow))
+ if ((BlockBelow == E_BLOCK_AIR) || IsAllowedBlock(BlockBelow))
+ {
return Y_MINUS;
+ }
*/
NIBBLETYPE LowestPoint = m_World.GetBlockMeta(a_X, a_Y, a_Z); // Current Block Meta so only lower points will be counted
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 34f2da682..fe145521f 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -416,24 +416,27 @@ static bool isLegalUTF8(const unsigned char * source, int length)
{
default: return false;
// Everything else falls through when "true"...
- case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
- case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 4: if (((a = (*--srcptr)) < 0x80) || (a > 0xbf)) return false;
+ 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
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
+ case 0xe0: if (a < 0xa0) return false; break;
+ case 0xed: if (a > 0x9f) return false; break;
+ case 0xf0: if (a < 0x90) return false; break;
+ case 0xf4: if (a > 0x8f) return false; break;
default: if (a < 0x80) return false;
}
}
- case 1: if (*source >= 0x80 && *source < 0xC2) return false;
+ case 1: if ((*source >= 0x80) && (*source < 0xc2)) return false;
+ }
+ if (*source > 0xf4)
+ {
+ return false;
}
- if (*source > 0xF4) return false;
return true;
}
@@ -446,11 +449,11 @@ AString UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length)
AString UTF16;
UTF16.reserve(a_UTF8Length * 3);
- const unsigned char * source = (const unsigned char*)a_UTF8;
+ const unsigned char * source = (const unsigned char *)a_UTF8;
const unsigned char * sourceEnd = source + a_UTF8Length;
const int halfShift = 10; // used for shifting by 10 bits
const unsigned int halfBase = 0x0010000UL;
- const unsigned int halfMask = 0x3FFUL;
+ const unsigned int halfMask = 0x3ffUL;
while (source < sourceEnd)
{
@@ -481,7 +484,7 @@ AString UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length)
if (ch <= UNI_MAX_BMP)
{
// Target is a character <= 0xFFFF
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END)
+ if ((ch >= UNI_SUR_HIGH_START) && (ch <= UNI_SUR_LOW_END))
{
// UTF-16 surrogate values are illegal in UTF-32
ch = ' ';
@@ -723,15 +726,15 @@ AString ReplaceAllCharOccurrences(const AString & a_String, char a_From, char a_
/// Converts one Hex character in a Base64 encoding into the data value
static inline int UnBase64(char c)
{
- if (c >='A' && c <= 'Z')
+ if ((c >='A') && (c <= 'Z'))
{
return c - 'A';
}
- if (c >='a' && c <= 'z')
+ if ((c >='a') && (c <= 'z'))
{
return c - 'a' + 26;
}
- if (c >= '0' && c <= '9')
+ if ((c >= '0') && (c <= '9'))
{
return c - '0' + 52;
}
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index e125c6aa4..53884dee8 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -14,15 +14,15 @@
-cTracer::cTracer(cWorld * a_World)
- : m_World(a_World)
+cTracer::cTracer(cWorld * a_World):
+ m_World(a_World)
{
- m_NormalTable[0].Set(-1, 0, 0);
- m_NormalTable[1].Set( 0, 0, -1);
- m_NormalTable[2].Set( 1, 0, 0);
- m_NormalTable[3].Set( 0, 0, 1);
- m_NormalTable[4].Set( 0, 1, 0);
- m_NormalTable[5].Set( 0, -1, 0);
+ m_NormalTable[0].Set(-1, 0, 0);
+ m_NormalTable[1].Set( 0, 0, -1);
+ m_NormalTable[2].Set( 1, 0, 0);
+ m_NormalTable[3].Set( 0, 0, 1);
+ m_NormalTable[4].Set( 0, 1, 0);
+ m_NormalTable[5].Set( 0, -1, 0);
}
@@ -37,7 +37,7 @@ cTracer::~cTracer()
-float cTracer::SigNum( float a_Num)
+float cTracer::SigNum(float a_Num)
{
if (a_Num < 0.f) return -1.f;
if (a_Num > 0.f) return 1.f;
@@ -127,7 +127,7 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction)
-bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance, bool a_LineOfSight)
+bool cTracer::Trace(const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance, bool a_LineOfSight)
{
if ((a_Start.y < 0) || (a_Start.y >= cChunkDef::Height))
{
@@ -249,35 +249,42 @@ int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float
{
// float linx, liny;
- float d=(x1-x0)*(y3-y2)-(y1-y0)*(x3-x2);
- if (std::abs(d)<0.001) {return 0;}
- float AB=((y0-y2)*(x3-x2)-(x0-x2)*(y3-y2))/d;
- if (AB>=0.0 && AB<=1.0)
+ float d = (x1 - x0) * (y3 - y2) - (y1 - y0) * (x3 - x2);
+ if (std::abs(d) < 0.001)
{
- float CD=((y0-y2)*(x1-x0)-(x0-x2)*(y1-y0))/d;
- if (CD>=0.0 && CD<=1.0)
+ return 0;
+ }
+
+ float AB = ((y0 - y2) * (x3 - x2) - (x0 - x2) * (y3 - y2)) / d;
+ if ((AB >= 0.0) && (AB <= 1.0))
+ {
+ float CD = ((y0 - y2) * (x1 - x0) - (x0 - x2) * (y1 - y0)) / d;
+ if ((CD >= 0.0) && (CD <= 1.0))
{
- // linx=x0+AB*(x1-x0);
- // liny=y0+AB*(y1-y0);
+ // linx = x0 + AB * (x1 - x0);
+ // liny = y0 + AB * (y1 - y0);
return 1;
}
}
return 0;
}
+
+
+
// intersect3D_SegmentPlane(): intersect a segment and a plane
// Input: a_Ray = a segment, and a_Plane = a plane = {Point V0; Vector n;}
// Output: *I0 = the intersect point (when it exists)
// Return: 0 = disjoint (no intersection)
// 1 = intersection in the unique point *I0
// 2 = the segment lies in the plane
-int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal)
+int cTracer::intersect3D_SegmentPlane(const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal)
{
Vector3f u = a_End - a_Origin; // a_Ray.P1 - S.P0;
Vector3f w = a_Origin - a_PlanePos; // S.P0 - Pn.V0;
- float D = a_PlaneNormal.Dot( u); // dot(Pn.n, u);
- float N = -(a_PlaneNormal.Dot( w)); // -dot(a_Plane.n, w);
+ float D = a_PlaneNormal.Dot(u); // dot(Pn.n, u);
+ float N = -(a_PlaneNormal.Dot(w)); // -dot(a_Plane.n, w);
const float EPSILON = 0.0001f;
if (fabs(D) < EPSILON)
@@ -294,12 +301,12 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f
// they are not parallel
// compute intersect param
float sI = N / D;
- if (sI < 0 || sI > 1)
+ if ((sI < 0) || (sI > 1))
{
return 0; // no intersection
}
- // Vector3f I ( a_Ray->GetOrigin() + sI * u);// S.P0 + sI * u; // compute segment intersect point
+ // Vector3f I (a_Ray->GetOrigin() + sI * u);// S.P0 + sI * u; // compute segment intersect point
RealHit = a_Origin + u * sI;
return 1;
}
@@ -311,9 +318,9 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f
int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos)
{
Vector3i SmallBlockPos = a_BlockPos;
- char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z);
+ char BlockID = m_World->GetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z);
- if (BlockID == E_BLOCK_AIR || IsBlockWater(BlockID))
+ if ((BlockID == E_BLOCK_AIR) || IsBlockWater(BlockID))
{
return 0;
}
@@ -324,86 +331,86 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
Vector3f Look = (end - start);
Look.Normalize();
- float dot = Look.Dot( Vector3f(-1, 0, 0)); // first face normal is x -1
+ float dot = Look.Dot(Vector3f(-1, 0, 0)); // first face normal is x -1
if (dot < 0)
{
- int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1);
+ int Lines = LinesCross(start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1);
+ Lines = LinesCross(start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(-1, 0, 0));
+ intersect3D_SegmentPlane(start, end, BlockPos, Vector3f(-1, 0, 0));
return 1;
}
}
}
- dot = Look.Dot( Vector3f(0, 0, -1)); // second face normal is z -1
+ dot = Look.Dot(Vector3f(0, 0, -1)); // second face normal is z -1
if (dot < 0)
{
- int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1);
+ int Lines = LinesCross(start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1);
+ Lines = LinesCross(start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, 0, -1));
+ intersect3D_SegmentPlane(start, end, BlockPos, Vector3f(0, 0, -1));
return 2;
}
}
}
- dot = Look.Dot( Vector3f(1, 0, 0)); // third face normal is x 1
+ dot = Look.Dot(Vector3f(1, 0, 0)); // third face normal is x 1
if (dot < 0)
{
- int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1);
+ int Lines = LinesCross(start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1);
+ Lines = LinesCross(start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0));
+ intersect3D_SegmentPlane(start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0));
return 3;
}
}
}
- dot = Look.Dot( Vector3f(0, 0, 1)); // fourth face normal is z 1
+ dot = Look.Dot(Vector3f(0, 0, 1)); // fourth face normal is z 1
if (dot < 0)
{
- int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1);
+ int Lines = LinesCross(start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1);
+ Lines = LinesCross(start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1));
+ intersect3D_SegmentPlane(start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1));
return 4;
}
}
}
- dot = Look.Dot( Vector3f(0, 1, 0)); // fifth face normal is y 1
+ dot = Look.Dot(Vector3f(0, 1, 0)); // fifth face normal is y 1
if (dot < 0)
{
- int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1);
+ int Lines = LinesCross(start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1);
+ Lines = LinesCross(start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0));
+ intersect3D_SegmentPlane(start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0));
return 5;
}
}
}
- dot = Look.Dot( Vector3f(0, -1, 0)); // sixth face normal is y -1
+ dot = Look.Dot(Vector3f(0, -1, 0)); // sixth face normal is y -1
if (dot < 0)
{
- int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1);
+ int Lines = LinesCross(start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1);
if (Lines == 1)
{
- Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1);
+ Lines = LinesCross(start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1);
if (Lines == 1)
{
- intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, -1, 0));
+ intersect3D_SegmentPlane(start, end, BlockPos, Vector3f(0, -1, 0));
return 6;
}
}
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 9113ec343..ff934c049 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1167,7 +1167,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
{
m_MaximumCost = 39;
}
- if (m_MaximumCost >= 40 && !a_Player.IsGameModeCreative())
+ if ((m_MaximumCost >= 40) && !a_Player.IsGameModeCreative())
{
Input.Empty();
}
diff --git a/src/World.cpp b/src/World.cpp
index 9a6ef5c30..7518327b9 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1809,7 +1809,7 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
a_FlyAwaySpeed /= 100; // Pre-divide, so that we don't have to divide each time inside the loop
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
- if (!IsValidItem(itr->m_ItemType) || itr->m_ItemType == E_BLOCK_AIR)
+ if (!IsValidItem(itr->m_ItemType) || (itr->m_ItemType == E_BLOCK_AIR))
{
// Don't spawn pickup if item isn't even valid; should prevent client crashing too
continue;
@@ -1835,7 +1835,7 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
{
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
- if (!IsValidItem(itr->m_ItemType) || itr->m_ItemType == E_BLOCK_AIR)
+ if (!IsValidItem(itr->m_ItemType) || (itr->m_ItemType == E_BLOCK_AIR))
{
continue;
}
diff --git a/src/XMLParser.h b/src/XMLParser.h
index 5b53e55cf..dab9699c9 100644
--- a/src/XMLParser.h
+++ b/src/XMLParser.h
@@ -105,11 +105,11 @@ public:
Destroy ();
// If the encoding or seperator are empty, then nullptr
- if (pszEncoding != nullptr && pszEncoding [0] == 0)
+ if ((pszEncoding != nullptr) && (pszEncoding[0] == 0))
{
pszEncoding = nullptr;
}
- if (pszSep != nullptr && pszSep [0] == 0)
+ if ((pszSep != nullptr) && (pszSep[0] == 0))
{
pszSep = nullptr;
}
@@ -147,7 +147,7 @@ public:
bool Parse (const char *pszBuffer, int nLength, bool fIsFinal = true)
{
assert (m_p != nullptr);
- return XML_Parse (m_p, pszBuffer, nLength, fIsFinal) != 0;
+ return (XML_Parse (m_p, pszBuffer, nLength, fIsFinal) != 0);
}
// @cmember Parse internal buffer