summaryrefslogtreecommitdiffhomepage
path: root/src/chunk.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-06-07 22:46:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-06-07 23:22:53 +0200
commit4a818328b3041afdd3be384beba41413d044c2de (patch)
treed2fdc982dc7aa27259d52fb698baed1e9e07df47 /src/chunk.cpp
parentb59abcd07e8c9bd2c79061f8cfc827a43c9408ef (diff)
wa
Diffstat (limited to 'src/chunk.cpp')
-rw-r--r--src/chunk.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp
index 57a3e62a..a7848936 100644
--- a/src/chunk.cpp
+++ b/src/chunk.cpp
@@ -3,6 +3,7 @@
#include "world.hpp"
#include "log.hpp"
#include "RTree.h"
+#include "compat/non-const.hpp"
#include <algorithm>
#include <cr/GrowableArray.h>
#include <cr/Optional.h>
@@ -33,7 +34,7 @@ bool chunk::empty(bool force) const noexcept
ground_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground ? _ground->atlases[i].get() : nullptr; }
tile_ref chunk::operator[](size_t idx) noexcept { return { *this, uint8_t(idx) }; }
-tile_proto chunk::operator[](size_t idx) const noexcept { return tile_proto(tile_ref { *const_cast<chunk*>(this), uint8_t(idx) }); }
+tile_proto chunk::operator[](size_t idx) const noexcept { return tile_proto(tile_ref { non_const(*this), uint8_t(idx) }); }
tile_ref chunk::operator[](local_coords xy) noexcept { return operator[](xy.to_index()); }
tile_proto chunk::operator[](local_coords xy) const noexcept { return operator[](xy.to_index()); }