summaryrefslogtreecommitdiffstats
path: root/src/ChunkDef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChunkDef.h')
-rw-r--r--src/ChunkDef.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index 188ad33d8..bdba4061f 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -144,6 +144,16 @@ public:
return ((a_Width >= 0) && (a_Width < Width));
}
+ /** Validates a chunk relative coordinate. Returns false if the coordiante is out of bounds for a chunk. */
+ inline static bool IsValidRelPos(Vector3i a_RelPos)
+ {
+ return (
+ IsValidWidth(a_RelPos.x) &&
+ IsValidHeight(a_RelPos.y) &&
+ IsValidWidth(a_RelPos.z)
+ );
+ }
+
/** Converts absolute block coords to chunk coords: */
inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ)
{