summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-24 14:12:06 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-24 14:18:55 +0100
commit6979582bef906b433ecf63e80bb5ed51b596d8c0 (patch)
treee189e3e1c934b78bff5184aee1fc93cc7b0aa777 /src
parent75146a4e6c3d5e239e62f9016801c757b21eb075 (diff)
fix -Wswitch-default
Diffstat (limited to 'src')
-rw-r--r--src/chunk-walls.cpp6
-rw-r--r--src/wall-atlas.cpp15
2 files changed, 8 insertions, 13 deletions
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<Quads::indexes> 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);
}