From cf1c5f4dcd59a45b2e03851d2a8e2a640c80d066 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Nov 2023 09:54:43 +0100 Subject: a --- loader/atlas.cpp | 10 ++-------- loader/wall-atlas.cpp | 3 +++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/loader/atlas.cpp b/loader/atlas.cpp index 3fd30e80..d71b85ad 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -79,14 +79,8 @@ ArrayView loader_impl::anim_atlas_list() std::shared_ptr loader_impl::anim_atlas(StringView name, StringView dir) noexcept(false) { fm_soft_assert(dir && dir[dir.size()-1] == '/'); - char path_buf[FILENAME_MAX]; - name = Path::splitExtension(name).first(); - const auto dirsiz = dir.size(), namesiz = name.size(); - fm_soft_assert(dirsiz + namesiz + 1 < FILENAME_MAX); - std::memcpy(path_buf, dir.data(), dirsiz); - std::memcpy(&path_buf[dirsiz], name.data(), namesiz); - path_buf[dirsiz + namesiz] = '\0'; - const StringView path = path_buf; + char buf[FILENAME_MAX]; + auto path = make_atlas_path(buf, dir, name); if (auto it = anim_atlas_map.find(path); it != anim_atlas_map.end()) return it->second; diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp index 10f3524d..99727e86 100644 --- a/loader/wall-atlas.cpp +++ b/loader/wall-atlas.cpp @@ -9,6 +9,7 @@ #include "serialize/corrade-string.hpp" #include #include +#include #include #include #include @@ -21,6 +22,8 @@ namespace floormat::loader_detail { std::shared_ptr loader_impl::get_wall_atlas(StringView filename) { + auto def = wall_atlas_def::deserialize(""_s.join({filename, ".json"_s})); + auto tex = texture(""_s, filename); using namespace floormat::Wall; using namespace floormat::Wall::detail; -- cgit v1.2.3