summary refs log tree commit diff
path: root/src/World/ChunkIndex.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-01-25 11:25:29 +0100
committerMel <einebeere@gmail.com>2024-01-25 11:25:29 +0100
commit66e436d0f2cf3c33105d8a5bce43bf64d5e72255 (patch)
tree3ee36001907453336cf96a57d8ec0154a9ae3135 /src/World/ChunkIndex.hpp
parentefd17623627607a26f33dac8f7ef1a1ddc931907 (diff)
downloadmeowcraft-66e436d0f2cf3c33105d8a5bce43bf64d5e72255.tar.zst
meowcraft-66e436d0f2cf3c33105d8a5bce43bf64d5e72255.zip
Mostly functioning world collisions
Diffstat (limited to 'src/World/ChunkIndex.hpp')
-rw-r--r--src/World/ChunkIndex.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/World/ChunkIndex.hpp b/src/World/ChunkIndex.hpp
index bc61f3d..da23e3d 100644
--- a/src/World/ChunkIndex.hpp
+++ b/src/World/ChunkIndex.hpp
@@ -31,6 +31,14 @@ struct ChunkIndex {
         return {chunk_x, chunk_y};
     }
 
+    static ChunkIndex from_position(Position::World pos) {
+        return from_position(pos.round_to_block());
+    }
+
+    Bool operator==(const ChunkIndex& other) const {
+        return x == other.x && y == other.y;
+    }
+
     I32 x, y;
 };