From a6514d1a95d0f84f0935866215463ef6aed23e19 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 7 Feb 2024 23:38:31 +0100 Subject: loader: work toward removing duplicate atlas code --- loader/anim.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'loader/anim.cpp') diff --git a/loader/anim.cpp b/loader/anim.cpp index 25b5e292..6fca5a49 100644 --- a/loader/anim.cpp +++ b/loader/anim.cpp @@ -1,5 +1,5 @@ #include "impl.hpp" -#include "loader/anim-info.hpp" +#include "loader/anim-cell.hpp" #include "compat/exception.hpp" #include "src/anim-atlas.hpp" #include @@ -58,9 +58,10 @@ ArrayView loader_impl::anim_atlas_list() std::shared_ptr loader_impl::anim_atlas(StringView name, StringView dir, loader_policy policy) noexcept(false) { if (name == INVALID) return make_invalid_anim_atlas().atlas; // todo! hack + fm_soft_assert(check_atlas_name(name)); fm_soft_assert(!dir || dir[dir.size()-1] == '/'); - char buf[FILENAME_MAX]; + char buf[fm_FILENAME_MAX]; auto path = make_atlas_path(buf, dir, name); if (auto it = anim_atlas_map.find(path); it != anim_atlas_map.end()) @@ -89,7 +90,7 @@ void loader_impl::get_anim_atlas_list() fm_assert(!anim_atlases.empty()); } -const anim_info& loader_impl::make_invalid_anim_atlas() +const anim_cell& loader_impl::make_invalid_anim_atlas() { if (invalid_anim_atlas) [[likely]] return *invalid_anim_atlas; @@ -115,11 +116,11 @@ const anim_info& loader_impl::make_invalid_anim_atlas() .nframes = 1, }; auto atlas = std::make_shared(INVALID, make_error_texture(size), std::move(def)); - auto info = anim_info { + auto info = anim_cell{ .name = INVALID, .atlas = atlas, }; - invalid_anim_atlas = Pointer{ InPlace, std::move(info) }; + invalid_anim_atlas = Pointer{ InPlace, std::move(info) }; return *invalid_anim_atlas; } -- cgit v1.2.3