summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-08 10:06:12 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-08 10:06:12 +0200
commitd17ed6b4ba01a73d33e3ff3ca8f0f6fb25259223 (patch)
treeda7b7cfccf239d447f1d2130f901ad885b07b0c7 /src
parent59becaeefcb564356d87aaf19cf67fccea311ca3 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/global-coords.hpp4
-rw-r--r--src/world.cpp2
-rw-r--r--src/world.hpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/global-coords.hpp b/src/global-coords.hpp
index f0d73c6f..9bdc311a 100644
--- a/src/global-coords.hpp
+++ b/src/global-coords.hpp
@@ -32,9 +32,9 @@ struct chunk_coords_ final {
int8_t z = 0;
explicit constexpr operator chunk_coords() const noexcept { return {x, y}; }
- constexpr chunk_coords_(chunk_coords c) noexcept : x{c.x}, y{c.y} {}
constexpr chunk_coords_() noexcept = default;
- constexpr chunk_coords_(int16_t x, int16_t y, int8_t z = 0) : x{x}, y{y}, z{z} {}
+ constexpr chunk_coords_(int16_t x, int16_t y, int8_t z = 0) noexcept : x{x}, y{y}, z{z} {}
+ constexpr chunk_coords_(chunk_coords c, int8_t z = 0) noexcept : x{c.x}, y{c.y}, z{z} {}
constexpr bool operator==(const chunk_coords_&) const noexcept = default;
};
diff --git a/src/world.cpp b/src/world.cpp
index 4e8e0095..ef78f313 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -91,7 +91,7 @@ chunk& world::operator[](chunk_coords_ coord) noexcept
auto world::operator[](global_coords pt) noexcept -> pair
{
- auto& c = operator[](pt.chunk());
+ auto& c = operator[]({pt.chunk(), pt.z()});
return { c, c[pt.local()] };
}
diff --git a/src/world.hpp b/src/world.hpp
index 47e6b01d..793b3605 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -77,7 +77,7 @@ public:
}
std::shared_ptr<T> make_entity(object_id id, global_coords pos, Xs&&... xs)
{
- auto ret = std::shared_ptr<T>(new T{id, operator[](pos.chunk()), std::forward<Xs>(xs)...});
+ auto ret = std::shared_ptr<T>(new T{id, operator[](chunk_coords_{pos.chunk(), pos.z()}), std::forward<Xs>(xs)...});
do_make_entity(std::static_pointer_cast<entity>(ret), pos, sorted);
return ret;
}