summaryrefslogtreecommitdiffstats
path: root/src/Defines.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-03-15 02:46:18 +0100
committerHowaner <franzi.moos@googlemail.com>2014-03-15 02:46:18 +0100
commit8316ae330ec06b19caf678b9d499afd198fe5a06 (patch)
tree9e120574de49e90f970910ffe743e8169d762ceb /src/Defines.h
parentAdd item frame saving. (diff)
parentIgnoring all config and SQLite files in the output folder. (diff)
downloadcuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar.gz
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar.bz2
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar.lz
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar.xz
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.tar.zst
cuberite-8316ae330ec06b19caf678b9d499afd198fe5a06.zip
Diffstat (limited to '')
-rw-r--r--src/Defines.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Defines.h b/src/Defines.h
index 6ab2274a4..3b7654265 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -2,6 +2,7 @@
#pragma once
#include "ChatColor.h"
+#include <limits>
@@ -276,6 +277,26 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
+/** Returns the textual representation of the BlockFace constant. */
+inline AString BlockFaceToString(eBlockFace a_BlockFace)
+{
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_XM: return "BLOCK_FACE_XM";
+ case BLOCK_FACE_XP: return "BLOCK_FACE_XP";
+ case BLOCK_FACE_YM: return "BLOCK_FACE_YM";
+ case BLOCK_FACE_YP: return "BLOCK_FACE_YP";
+ case BLOCK_FACE_ZM: return "BLOCK_FACE_ZM";
+ case BLOCK_FACE_ZP: return "BLOCK_FACE_ZP";
+ case BLOCK_FACE_NONE: return "BLOCK_FACE_NONE";
+ }
+ return Printf("Unknown BLOCK_FACE: %d", a_BlockFace);
+}
+
+
+
+
+
inline bool IsValidBlock(int a_BlockType)
{
if (
@@ -469,7 +490,7 @@ inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a
inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, double & a_Pitch)
{
- if (a_X != 0)
+ if (fabs(a_X) < std::numeric_limits<double>::epsilon())
{
a_Pan = atan2(a_Z, a_X) * 180 / PI - 90;
}