From e53afc53ae4344235736af2956630d1d4f95fdf0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 10 Jan 2024 05:04:41 +0100 Subject: a --- editor/imgui-editors.cpp | 2 +- loader/wall-atlas.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/editor/imgui-editors.cpp b/editor/imgui-editors.cpp index fa7f23f5..5dc4f281 100644 --- a/editor/imgui-editors.cpp +++ b/editor/imgui-editors.cpp @@ -36,7 +36,7 @@ StringView scenery_type_to_string(const scenery_& sc) StringView scenery_path(const wall_info* wa) { return wa->atlas->name(); } StringView scenery_name(StringView name, const scenery_& sc) { return name; } StringView scenery_name(StringView, const vobj_& vobj) { return vobj.descr; } -StringView scenery_name(StringView, const wall_info* w) { return w->name; } +StringView scenery_name(StringView, const wall_info* w) { return w->descr; } std::shared_ptr get_atlas(const scenery_& sc) { return sc.proto.atlas; } std::shared_ptr get_atlas(const vobj_& vobj) { return vobj.factory->atlas(); } std::shared_ptr get_atlas(const wall_info* w) { return loader.wall_atlas(w->name); } diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp index 1e63a6c9..242702e3 100644 --- a/loader/wall-atlas.cpp +++ b/loader/wall-atlas.cpp @@ -25,6 +25,8 @@ using loader_detail::loader_impl; fm_soft_assert(loader.check_atlas_name(val.name)); if (j.contains("descr")) val.descr = j["descr"]; + else + val.descr = Path::split(val.name).second(); } [[maybe_unused]] static void to_json(json& j, const wall_info& val) @@ -41,7 +43,8 @@ namespace floormat::loader_detail { std::shared_ptr loader_impl::get_wall_atlas(StringView name, StringView path) { fm_assert(name != ""_s); - auto filename = Path::join(path, name); + char buf[FILENAME_MAX]; + auto filename = make_atlas_path(buf, path, name); auto def = wall_atlas_def::deserialize(""_s.join({filename, ".json"_s})); auto tex = texture(""_s, filename, false); @@ -99,9 +102,6 @@ std::shared_ptr loader_impl::wall_atlas(StringView name, bool goto error; } - std::unreachable(); - fm_assert(false); - missing: { // todo allocate wall_info instead -- cgit v1.2.3