summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-21 18:30:33 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-22 04:17:19 +0100
commitfbe6aa987bd238c559a306d43027a5315eafefd0 (patch)
treebd24d0cb4cd0020821b17eddffc4e59fd392d385 /serialize
parentb1174fca2f52391fd6ce33b49f50a37a7ceac3aa (diff)
fix warn 2
Diffstat (limited to 'serialize')
-rw-r--r--serialize/savegame.cpp32
1 files changed, 18 insertions, 14 deletions
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_<reader>
f(id);
switch (type)
{
- default: fm_throw("invalid atlas type {}"_cf, (int)type);
- case atlas_type::anim: a = loader.anim_atlas(get_atlas<atlas_type::anim>(id), {}, loader_policy::warn); return;
- case atlas_type::vobj: a = loader.vobj(get_atlas<atlas_type::vobj>(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<atlas_type::anim>(id), {}, loader_policy::warn);
+ break;
+ case atlas_type::vobj:
+ a = loader.vobj(get_atlas<atlas_type::vobj>(id)).atlas;
+ break;
}
}
@@ -817,18 +822,18 @@ struct reader final : visitor_<reader>
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<light>(); goto ok;
+ obj = w.make_unconnected_object<light>(); break;
case object_type::critter:
- obj = w.make_unconnected_object<critter>(); goto ok;
+ obj = w.make_unconnected_object<critter>(); break;
case object_type::scenery:
- obj = w.make_unconnected_object<scenery>(); goto ok;
+ obj = w.make_unconnected_object<scenery>(); 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 });
}
}