From 6979582bef906b433ecf63e80bb5ed51b596d8c0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 24 Mar 2024 14:12:06 +0100 Subject: fix -Wswitch-default --- src/chunk-walls.cpp | 6 ++---- src/wall-atlas.cpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/chunk-walls.cpp b/src/chunk-walls.cpp index b9085531..13f42ead 100644 --- a/src/chunk-walls.cpp +++ b/src/chunk-walls.cpp @@ -44,8 +44,8 @@ constexpr Quads::quad get_quad(Direction_ D, Group_ G, float depth) switch (G) { using enum Group_; - case COUNT: - std::unreachable(); + default: + fm_abort("invalid wall_atlas group '%d'", (int)G); case wall: if (!is_west) return {{ @@ -107,8 +107,6 @@ constexpr Quads::quad get_quad(Direction_ D, Group_ G, float depth) {-X, -Y, Z }, }}; } - std::unreachable(); - fm_abort("invalid wall_atlas group '%d'", (int)G); } Array make_indexes_() diff --git a/src/wall-atlas.cpp b/src/wall-atlas.cpp index 1d043db0..49b00311 100644 --- a/src/wall-atlas.cpp +++ b/src/wall-atlas.cpp @@ -214,19 +214,16 @@ auto wall_atlas::calc_direction(Direction_ dir) const -> const Direction& if (auto dai = _direction_map[(size_t)dir]) [[likely]] return _dir_array[dai.val]; CORRADE_ASSUME(dir < Direction_::COUNT); + Direction_ other; switch (dir) { - case Direction_::N: - if (auto dai = _direction_map[(size_t)Direction_::W]) - return _dir_array[dai.val]; - break; - case Direction_::W: + case Direction_::N: other = Direction_::W; break; + case Direction_::W: other = Direction_::N; break; + default: other = Direction_::COUNT; + } + if (other != Direction_::COUNT) if (auto dai = _direction_map[(size_t)Direction_::N]) return _dir_array[dai.val]; - break; - case Direction_::COUNT: - std::unreachable(); - } fm_abort("wall_atlas: can't find direction '%d'", (int)dir); } -- cgit v1.2.3