summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-04-08 17:05:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-04-08 19:40:10 +0200
commit064379bd0bd929f6b87c50f740e9a783b4d9e054 (patch)
treeb717428ace85bde06fff19ac96b11d95787b538f /editor
parent4eefaf4e12199c071d2e6ee0d99b46d2e1d45557 (diff)
a
Diffstat (limited to 'editor')
-rw-r--r--editor/draw.cpp2
-rw-r--r--editor/inspect-types.cpp10
-rw-r--r--editor/inspect.cpp6
-rw-r--r--editor/update.cpp7
-rw-r--r--editor/wall-editor.cpp4
5 files changed, 18 insertions, 11 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp
index 63bc02e8..249bf72c 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -60,7 +60,7 @@ void app::draw_cursor()
{
case rotation::N: draw(_wireframe->wall_n, TILE_SIZE); break;
case rotation::W: draw(_wireframe->wall_w, TILE_SIZE); break;
- default: std::unreachable();
+ default: fm_assert(false);
}
}
else if (const auto* ed = _editor->current_scenery_editor())
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp
index 331b82a7..be8851ce 100644
--- a/editor/inspect-types.cpp
+++ b/editor/inspect-types.cpp
@@ -277,13 +277,17 @@ template bool inspect_type(light&, inspect_intent_t);
bool inspect_object_subtype(object& x)
{
- switch (auto type = x.type())
+ const auto type = x.type();
+ switch (type)
{
- default: fm_warn_once("unknown object subtype '%d'", (int)type); return false;
case object_type::scenery: return inspect_type(static_cast<scenery&>(x), inspect_intent_t{});
case object_type::critter: return inspect_type(static_cast<critter&>(x), inspect_intent_t{});
- case object_type::light: return inspect_type(static_cast<light&>(x), inspect_intent_t{});
+ case object_type::light: return inspect_type(static_cast<light&>(x), inspect_intent_t{});
+ case object_type::COUNT: break;
+ case object_type::none: break;
}
+ fm_warn_once("unknown object subtype '%d'", (int)type);
+ return false;
}
} // namespace floormat::entities
diff --git a/editor/inspect.cpp b/editor/inspect.cpp
index c4345bcf..470c5bd2 100644
--- a/editor/inspect.cpp
+++ b/editor/inspect.cpp
@@ -75,13 +75,15 @@ bool do_inspect_field(void* datum, const erased_accessor& accessor, field_repr r
char buf[128];
bool should_disable = false;
- switch (accessor.is_enabled(datum))
+ const auto enabled = accessor.is_enabled(datum);
+ fm_assert(enabled < field_status::COUNT);
+ switch (enabled)
{
using enum field_status;
+ case COUNT: fm_assert(false);
case hidden: return false;
case readonly: should_disable = true; break;
case enabled: should_disable = false; break;
- default: fm_assert(false);
}
should_disable = should_disable || !accessor.can_write();
[[maybe_unused]] auto disabler = begin_disabled(should_disable);
diff --git a/editor/update.cpp b/editor/update.cpp
index a4b9bbcd..823c8c01 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -55,7 +55,7 @@ void app::do_mouse_up_down(uint8_t button, bool is_down, int mods)
{
switch (_editor->mode())
{
- default:
+ case editor_mode::tests:
break;
case editor_mode::none:
if (button == mouse_button_left)
@@ -78,8 +78,8 @@ void app::do_mouse_up_down(uint8_t button, bool is_down, int mods)
case editor_mode::floor:
case editor_mode::walls:
case editor_mode::scenery:
- case editor_mode::vobj:
- auto pos = *cursor.tile;
+ case editor_mode::vobj: {
+ const auto pos = *cursor.tile;
switch (button)
{
case mouse_button_left:
@@ -92,6 +92,7 @@ void app::do_mouse_up_down(uint8_t button, bool is_down, int mods)
}
break;
}
+ }
}
_editor->on_release();
}
diff --git a/editor/wall-editor.cpp b/editor/wall-editor.cpp
index 58054b15..99d47643 100644
--- a/editor/wall-editor.cpp
+++ b/editor/wall-editor.cpp
@@ -83,7 +83,7 @@ void wall_editor::place_tile(world& w, global_coords coords, const std::shared_p
{
case rotation::N: t.wall_north() = { atlas, (variant_t)-1 }; break;
case rotation::W: t.wall_west() = { atlas, (variant_t)-1 }; break;
- default: std::unreachable();
+ default: fm_assert(false);
}
//c.mark_walls_modified();
for (int y = -1; y <= 1; y++)
@@ -102,7 +102,7 @@ editor_snap_mode wall_editor::check_snap(int mods) const
else if (_r == rotation::W)
return editor_snap_mode::vertical;
else
- std::unreachable();
+ fm_assert(false);
}
} // namespace floormat