diff options
Diffstat (limited to 'src/tile.cpp')
| -rw-r--r-- | src/tile.cpp | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/tile.cpp b/src/tile.cpp index 419e59a3..34d2a6e1 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -3,33 +3,6 @@ namespace floormat { -pass_mode_ref::pass_mode_ref(chunk& c, std::uint8_t i) noexcept : _chunk{&c}, i{i} -{ -} - -pass_mode_ref& pass_mode_ref::operator=(pass_mode val) noexcept -{ - auto x = std::underlying_type_t<pass_mode>(val) & pass_mode_COUNT; - auto& bitset = _chunk->_passability; - bitset[i*2 + 0] = x & 1; - bitset[i*2 + 1] = x >> 1 & 1; - return *this; -} - -pass_mode_ref& pass_mode_ref::operator=(const pass_mode_ref& x) noexcept -{ - return operator=(pass_mode(x)); // NOLINT(misc-unconventional-assign-operator) -} - -pass_mode_ref::operator pass_mode() const noexcept -{ - auto& bitset = _chunk->_passability; - std::uint8_t ret = 0; - ret |= (std::uint8_t)bitset[i*2 + 1]; - ret |= (std::uint8_t)bitset[i*2 + 0] << 1; - return pass_mode(ret); -} - bool operator==(const tile_proto& a, const tile_proto& b) noexcept { return a.ground() == b.ground() && a.wall_north() == b.wall_north() && @@ -64,15 +37,11 @@ tile_image_proto tile_ref::wall_north() const noexcept { return { _chunk->_wall_ tile_image_proto tile_ref::wall_west() const noexcept { return { _chunk->_wall_atlases[i*2+1], _chunk->_wall_variants[i*2+1] }; } scenery_proto tile_ref::scenery() const noexcept { return { _chunk->_scenery_atlases[i], _chunk->_scenery_variants[i] }; } -pass_mode_ref tile_ref::passability() noexcept { return { *_chunk, i }; } -pass_mode tile_ref::passability() const noexcept { return pass_mode_ref { *const_cast<struct chunk*>(_chunk), i }; } - tile_ref::operator tile_proto() const noexcept { return { _chunk->_ground_atlases[i], _chunk->_wall_atlases[i*2+0], _chunk->_wall_atlases[i*2+1], _chunk->_scenery_atlases[i], _chunk->_ground_variants[i], _chunk->_wall_variants[i*2+0], _chunk->_wall_variants[i*2+1], _chunk->_scenery_variants[i], - passability(), }; } @@ -84,8 +53,7 @@ bool operator==(const tile_ref& a, const tile_ref& b) noexcept return a.ground() == b.ground() && a.wall_north() == b.wall_north() && a.wall_west() == b.wall_west() && - a.scenery() == b.scenery() && - a.passability() == b.passability(); + a.scenery() == b.scenery(); } } // namespace floormat |
