summaryrefslogtreecommitdiffstats
path: root/src/Defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Defines.h')
-rw-r--r--src/Defines.h33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/Defines.h b/src/Defines.h
index f57e63c7f..9f66cbf9b 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -470,18 +470,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
{
int Y = a_BlockY;
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
- if (Y < 0)
- {
- a_BlockY = 0;
- }
- else if (Y > 255)
- {
- a_BlockY = 255;
- }
- else
- {
- a_BlockY = (unsigned char)Y;
- }
+ a_BlockY = Clamp<unsigned char>((unsigned char)Y, 0, 255);
}
@@ -490,9 +479,9 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z)
{
- // a_X = sinf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI );
- // a_Y = -sinf ( a_Pitch / 180 * PI );
- // a_Z = -cosf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI );
+ // a_X = sinf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
+ // a_Y = -sinf ( a_Pitch / 180 * PI);
+ // a_Z = -cosf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
a_X = cos(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
a_Y = sin(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
a_Z = sin(a_Pitch / 180 * PI);
@@ -530,7 +519,7 @@ inline float GetSignf(float a_Val)
-inline float GetSpecialSignf( float a_Val )
+inline float GetSpecialSignf( float a_Val)
{
return (a_Val <= 0.f) ? -1.f : 1.f;
}
@@ -651,11 +640,11 @@ namespace ItemCategory
inline bool IsTool(short a_ItemID)
{
- return IsPickaxe( a_ItemID )
- || IsAxe ( a_ItemID )
- || IsSword ( a_ItemID )
- || IsHoe ( a_ItemID )
- || IsShovel ( a_ItemID );
+ return IsPickaxe( a_ItemID)
+ || IsAxe ( a_ItemID)
+ || IsSword ( a_ItemID)
+ || IsHoe ( a_ItemID)
+ || IsShovel ( a_ItemID);
}
@@ -728,7 +717,7 @@ namespace ItemCategory
inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
{
- if(!IsValidBlock(a_BlockType)) return false;
+ if (!IsValidBlock(a_BlockType)) return false;
return cBlockInfo::RequiresSpecialTool(a_BlockType);
}