From 9107e0ff64fc5788d90c0b44da3f7148cba4f966 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Oct 2022 22:18:01 +0200 Subject: a --- src/chunk.hpp | 13 +++++++------ src/tile.hpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/chunk.hpp b/src/chunk.hpp index 829ee0d3..bf5833a3 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -7,10 +7,11 @@ namespace Magnum::Examples { struct chunk final { - constexpr tile& operator[](local_coords xy) { return tiles[xy.to_index()]; } - constexpr const tile& operator[](local_coords xy) const { return tiles[xy.to_index()]; } - constexpr tile& operator[](std::size_t i) { return tiles[i]; } - constexpr const tile& operator[](std::size_t i) const { return tiles[i]; } + constexpr tile& operator[](local_coords xy) { return _tiles[xy.to_index()]; } + constexpr const tile& operator[](local_coords xy) const { return _tiles[xy.to_index()]; } + constexpr tile& operator[](std::size_t i) { return _tiles[i]; } + constexpr const tile& operator[](std::size_t i) const { return _tiles[i]; } + auto& tiles() const { return _tiles; } template requires std::invocable @@ -24,7 +25,7 @@ private: template constexpr void foreach_tile_(F&& fun); - std::array tiles = {}; + std::array _tiles = {}; }; template @@ -34,7 +35,7 @@ constexpr void chunk::foreach_tile_(F&& fun) std::size_t k = 0; for (std::size_t j = 0; j < N; j++) for (std::size_t i = 0; i < N; i++, k++) - fun(const_cast(*this).tiles[k], k, + fun(const_cast(*this)._tiles[k], k, local_coords{(std::uint8_t)i, (std::uint8_t)j}); } diff --git a/src/tile.hpp b/src/tile.hpp index 261c50ee..eadfa745 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -25,7 +25,7 @@ struct tile final enum class pass_mode : std::uint8_t { pass_blocked, pass_ok, pass_shoot_through, }; using enum pass_mode; - tile_image ground_image, wall_west, wall_north; + tile_image ground_image, wall_north, wall_west; pass_mode passability = pass_shoot_through; }; -- cgit v1.2.3