diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-07-22 18:56:19 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-07-22 21:17:41 +0200 |
| commit | 125cb3c0feb94e51b830957fb44ccc709b6afa61 (patch) | |
| tree | 9dfc68af6c2c010a31ff9d3418ccab2f221da448 /src/chunk.cpp | |
| parent | 391e513ab8100b4ef0ab783354640fcff2be6c36 (diff) | |
src/chunk: move big arrays to separate heap allocation
Diffstat (limited to 'src/chunk.cpp')
| -rw-r--r-- | src/chunk.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp index 5450a02e..ff35f292 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -27,15 +27,15 @@ bool chunk::empty(bool force) const noexcept if (!force && !_maybe_empty) return false; for (auto i = 0uz; i < TILE_COUNT; i++) - if (_ground_atlases[i] || _wall_atlases[i*2 + 0] || _wall_atlases[i*2 + 1] || !_entities.empty()) + if (!_entities.empty() || _ground && _ground->_ground_atlases[i] || _walls && (_walls->_wall_atlases[i*2+0] || _walls->_wall_atlases[i*2+1])) return _maybe_empty = false; if (!_entities.empty()) return false; return true; } -tile_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground_atlases[i].get(); } -tile_atlas* chunk::wall_atlas_at(size_t i) const noexcept { return _wall_atlases[i].get(); } +tile_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground ? _ground->_ground_atlases[i].get() : nullptr; } +tile_atlas* chunk::wall_atlas_at(size_t i) const noexcept { return _walls ? _walls->_wall_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) }); } |
