From d74a0ca1f0bca44b4c2ea657139cfadf883f0e4f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Jun 2024 04:20:47 +0200 Subject: c inspector window title --- editor/inspect-draw.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/editor/inspect-draw.cpp b/editor/inspect-draw.cpp index c420c03e..f3b4982f 100644 --- a/editor/inspect-draw.cpp +++ b/editor/inspect-draw.cpp @@ -75,46 +75,52 @@ void app::entity_friendly_name(char* buf, size_t len, const object& obj) { switch (obj.type()) { - default: - std::snprintf(buf, len, "(unknown?)"); + case object_type::none: + case object_type::COUNT: break; + case object_type::hole: + std::snprintf(buf, len, "%s", "hole"); + return; case object_type::critter: { const auto& c = static_cast(obj); std::snprintf(buf, len, "critter %s", c.name.data()); - break; + return; } case object_type::light: { const auto& L = static_cast(obj); - const char* type; + const char* type = "(unknown?)"; switch (L.falloff) { + case light_falloff::COUNT: break; case light_falloff::constant: type = "constant"; break; case light_falloff::linear: type = "linear"; break; case light_falloff::quadratic: type = "quadratic"; break; - default: type = "(unknown?)"; break; } std::snprintf(buf, len, "light #%hhx%hhx%hhx%hhx %s:%.2f", L.color.r(), L.color.g(), L.color.b(), L.color.a(), type, L.falloff == light_falloff::constant ? 0. : (double)L.max_distance); - break; + return; } case object_type::scenery: { const auto& sc = static_cast(obj); switch (sc.scenery_type()) { - default: - std::snprintf(buf, len, "(unknown?)"); + case scenery_type::none: + case scenery_type::COUNT: break; case scenery_type::door: std::snprintf(buf, len, "door"); - break; + return; case scenery_type::generic: std::snprintf(buf, len, "scenery %s", sc.atlas->name().data()); - break; + return; } + std::snprintf(buf, len, "(scenery?)"); + return; } } + std::snprintf(buf, len, "(unknown?)"); } } // namespace floormat -- cgit v1.2.3