summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-11-10 22:19:57 +0100
committerworktycho <work.tycho@gmail.com>2015-11-10 22:19:57 +0100
commit951569faaa4e957f4884ab4f3d2fead00e6bccb3 (patch)
tree4a10e0dbcb21ade64d43592802c568655816935f
parentMerge pull request #2631 from Gargaj/divby0 (diff)
parentAdded cChunkDef::IsValidHeight() (diff)
downloadcuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar.gz
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar.bz2
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar.lz
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar.xz
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.tar.zst
cuberite-951569faaa4e957f4884ab4f3d2fead00e6bccb3.zip
-rw-r--r--src/ChunkDef.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index fcda9b5a6..c69f1fdf3 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -115,6 +115,12 @@ public:
return Vector3i(a_RelBlockPosition.x + a_ChunkX * Width, a_RelBlockPosition.y, a_RelBlockPosition.z + a_ChunkZ * Width);
}
+ /** Validates a height-coordinate. Returns false if height-coordiante is out of height bounds */
+ inline static bool IsValidHeight(int a_Height)
+ {
+ return ((a_Height >= 0) && (a_Height < Height));
+ }
+
/** Converts absolute block coords to chunk coords: */
inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ)