From fbe6aa987bd238c559a306d43027a5315eafefd0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 21 Mar 2024 18:30:33 +0100 Subject: fix warn 2 --- serialize/savegame.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'serialize') diff --git a/serialize/savegame.cpp b/serialize/savegame.cpp index 7d40d9e3..5c22b98a 100644 --- a/serialize/savegame.cpp +++ b/serialize/savegame.cpp @@ -797,12 +797,17 @@ struct reader final : visitor_ f(id); switch (type) { - default: fm_throw("invalid atlas type {}"_cf, (int)type); - case atlas_type::anim: a = loader.anim_atlas(get_atlas(id), {}, loader_policy::warn); return; - case atlas_type::vobj: a = loader.vobj(get_atlas(id)).atlas; return; case atlas_type::ground: case atlas_type::wall: case atlas_type::none: + default: + fm_throw("invalid atlas type {}"_cf, (int)type); + case atlas_type::anim: + a = loader.anim_atlas(get_atlas(id), {}, loader_policy::warn); + break; + case atlas_type::vobj: + a = loader.vobj(get_atlas(id)).atlas; + break; } } @@ -817,18 +822,18 @@ struct reader final : visitor_ switch (type) { + default: fm_throw("invalid object type {}"_cf, type_); case object_type::none: case object_type::COUNT: break; case object_type::light: - obj = w.make_unconnected_object(); goto ok; + obj = w.make_unconnected_object(); break; case object_type::critter: - obj = w.make_unconnected_object(); goto ok; + obj = w.make_unconnected_object(); break; case object_type::scenery: - obj = w.make_unconnected_object(); goto ok; + obj = w.make_unconnected_object(); break; } - fm_throw("invalid object type {}"_cf, type_); -ok: + visit_object_internal(*obj, f, id, object_type(type), ch); if (PROTO >= 21) [[likely]] @@ -903,22 +908,21 @@ ok: void* atlas = nullptr; switch (type) { + default: fm_throw("invalid atlas_type {}"_cf, (size_t)type); case atlas_type::none: break; case atlas_type::ground: atlas = loader.ground_atlas(str, loader_policy::warn).get(); - goto ok; + break; case atlas_type::wall: atlas = loader.wall_atlas(str, loader_policy::warn).get(); - goto ok; + break; case atlas_type::anim: atlas = loader.anim_atlas(str, {}, loader_policy::warn).get(); - goto ok; + break; case atlas_type::vobj: atlas = loader.vobj(str).atlas.get(); - goto ok; + break; } - fm_throw("invalid atlas_type {}"_cf, (size_t)type); -ok: atlases.push_back({.atlas = atlas, .type = type }); } } -- cgit v1.2.3