summaryrefslogtreecommitdiffhomepage
path: root/loader/wall-atlas.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-11 16:40:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-11 16:40:29 +0100
commitba90ba2ca91c448d80722985811fc6bddc6e9bf2 (patch)
tree2a81ee054bad7f76457be6e91359039fcc9a8780 /loader/wall-atlas.cpp
parentd74df1b763979d281f76f3f30543aee8d8a638b7 (diff)
w
Diffstat (limited to 'loader/wall-atlas.cpp')
-rw-r--r--loader/wall-atlas.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp
index 7d423b26..69666e8c 100644
--- a/loader/wall-atlas.cpp
+++ b/loader/wall-atlas.cpp
@@ -40,21 +40,21 @@ using loader_detail::loader_impl;
namespace floormat::loader_detail {
-std::shared_ptr<wall_atlas> loader_impl::get_wall_atlas(StringView name, StringView path)
+std::shared_ptr<wall_atlas> loader_impl::get_wall_atlas(StringView name, StringView dir)
{
fm_assert(name != "<invalid>"_s);
char buf[FILENAME_MAX];
- auto filename = make_atlas_path(buf, path, name);
+ auto filename = make_atlas_path(buf, dir, name);
auto def = wall_atlas_def::deserialize(""_s.join({filename, ".json"_s}));
auto tex = texture(""_s, filename);
fm_soft_assert(name == def.header.name);
fm_soft_assert(!def.frames.empty());
- auto atlas = std::make_shared<class wall_atlas>(std::move(def), path, tex);
+ auto atlas = std::make_shared<class wall_atlas>(std::move(def), dir, tex);
return atlas;
}
-const wall_info& loader_impl::make_invalid_wall_atlas() noexcept
+const wall_info& loader_impl::make_invalid_wall_atlas()
{
if (invalid_wall_atlas) [[likely]]
return *invalid_wall_atlas;
@@ -121,6 +121,8 @@ error:
void loader_impl::get_wall_atlas_list()
{
+ fm_assert(wall_atlas_map.empty());
+
wall_atlas_array = json_helper::from_json<std::vector<wall_info>>(Path::join(WALL_TILESET_PATH, "walls.json"_s));
wall_atlas_array.shrink_to_fit();
wall_atlas_map.clear();