summaryrefslogtreecommitdiffhomepage
path: root/src/world.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-10 09:04:07 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-10 10:35:00 +0200
commit95b940b807eb213e2e86a32f8f4cc98fd6b13400 (patch)
treec42c9ba29424e56e27ed2b81eecf8c2d07dde910 /src/world.cpp
parent8c2dca2cfaf57f22fe2fe84d939d0071c06ddd6c (diff)
src/world: cleanup & fix hash stuff
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/world.cpp b/src/world.cpp
index f0818b44..028ddd45 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -2,6 +2,7 @@
#include "chunk.hpp"
#include "entity.hpp"
#include "compat/int-hash.hpp"
+#include "compat/exception.hpp"
using namespace floormat;
@@ -12,9 +13,9 @@ size_t std::hash<chunk_coords_>::operator()(const chunk_coords_& coord) const no
x |= size_t(uint16_t(coord.y)) << 16;
x |= size_t(uint16_t(coord.x));
if constexpr(sizeof(size_t) > 4)
- x |= size_t(uint8_t(coord.z+8) & 0xf) << 20;
+ x |= size_t(uint8_t(coord.z-chunk_min_z) & 0xf) << 32;
else
- x ^= size_t(uint8_t(coord.z+8) & 0xf) * size_t(1664525);
+ x ^= size_t(uint8_t(coord.z-chunk_min_z) & 0xf) * size_t(1664525);
return int_hash(x);
}