diff options
Diffstat (limited to 'loader')
-rw-r--r-- | loader/atlas.cpp | 18 | ||||
-rw-r--r-- | loader/impl.hpp | 10 | ||||
-rw-r--r-- | loader/json.cpp | 16 | ||||
-rw-r--r-- | loader/loader.hpp | 8 |
4 files changed, 26 insertions, 26 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp index e2ecb956..c7bfbdbf 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -2,7 +2,7 @@ #include "compat/assert.hpp" #include "compat/exception.hpp" #include "src/emplacer.hpp" -#include "src/tile-atlas.hpp" +#include "src/ground-atlas.hpp" #include "src/anim-atlas.hpp" #include <cstdio> #include <algorithm> @@ -45,9 +45,9 @@ bool loader_::check_atlas_name(StringView str) noexcept namespace floormat::loader_detail { -std::shared_ptr<tile_atlas> loader_impl::tile_atlas(StringView name, Vector2ub size, pass_mode pass) noexcept(false) +std::shared_ptr<ground_atlas> loader_impl::ground_atlas(StringView name, Vector2ub size, pass_mode pass) noexcept(false) { - if (auto it = tile_atlas_map.find(name); it != tile_atlas_map.end()) + if (auto it = ground_atlas_map.find(name); it != ground_atlas_map.end()) { fm_assert(it->second->pass_mode() == pass); return it->second; @@ -58,16 +58,16 @@ std::shared_ptr<tile_atlas> loader_impl::tile_atlas(StringView name, Vector2ub s char buf[FILENAME_MAX]; auto path = make_atlas_path(buf, IMAGE_PATH, name); - auto atlas = std::make_shared<class tile_atlas>(path, name, texture(""_s, path), size, pass); - tile_atlas_map[atlas->name()] = atlas; + auto atlas = std::make_shared<class ground_atlas>(path, name, texture(""_s, path), size, pass); + ground_atlas_map[atlas->name()] = atlas; return atlas; } -std::shared_ptr<class tile_atlas> loader_impl::tile_atlas(StringView filename) noexcept(false) +std::shared_ptr<class ground_atlas> loader_impl::ground_atlas(StringView filename) noexcept(false) { - fm_assert(!tile_atlas_map.empty()); - auto it = tile_atlas_map.find(filename); - if (it == tile_atlas_map.end()) + fm_assert(!ground_atlas_map.empty()); + auto it = ground_atlas_map.find(filename); + if (it == ground_atlas_map.end()) fm_throw("no such tile atlas '{}'"_cf, filename); return it->second; } diff --git a/loader/impl.hpp b/loader/impl.hpp index d88174ba..165b7c2f 100644 --- a/loader/impl.hpp +++ b/loader/impl.hpp @@ -59,12 +59,12 @@ struct loader_impl final : loader_ std::shared_ptr<class wall_atlas> get_wall_atlas(StringView name, StringView path); // >-----> tile >-----> - tsl::robin_map<StringView, std::shared_ptr<class tile_atlas>> tile_atlas_map; - std::vector<std::shared_ptr<class tile_atlas>> tile_atlas_array; + tsl::robin_map<StringView, std::shared_ptr<class ground_atlas>> ground_atlas_map; + std::vector<std::shared_ptr<class ground_atlas>> ground_atlas_array; - ArrayView<const std::shared_ptr<class tile_atlas>> tile_atlases(StringView filename) noexcept(false) override; - std::shared_ptr<class tile_atlas> tile_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) override; - std::shared_ptr<class tile_atlas> tile_atlas(StringView filename) noexcept(false) override; + ArrayView<const std::shared_ptr<class ground_atlas>> ground_atlases(StringView filename) noexcept(false) override; + std::shared_ptr<class ground_atlas> ground_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) override; + std::shared_ptr<class ground_atlas> ground_atlas(StringView filename) noexcept(false) override; // >-----> anim >-----> tsl::robin_map<StringView, std::shared_ptr<class anim_atlas>> anim_atlas_map; diff --git a/loader/json.cpp b/loader/json.cpp index 7cf24015..8e2f329f 100644 --- a/loader/json.cpp +++ b/loader/json.cpp @@ -1,10 +1,10 @@ #include "impl.hpp" #include "compat/assert.hpp" #include "compat/exception.hpp" -#include "src/tile-atlas.hpp" +#include "src/ground-atlas.hpp" #include "serialize/json-helper.hpp" #include "serialize/anim.hpp" -#include "serialize/tile-atlas.hpp" +#include "serialize/ground-atlas.hpp" #include "serialize/scenery.hpp" #include "loader/scenery.hpp" #include <Corrade/Containers/ArrayViewStl.h> @@ -53,14 +53,14 @@ const scenery_proto& loader_impl::scenery(StringView name) noexcept(false) return it->second->proto; } -ArrayView<const std::shared_ptr<class tile_atlas>> loader_impl::tile_atlases(StringView filename) +ArrayView<const std::shared_ptr<class ground_atlas>> loader_impl::ground_atlases(StringView filename) noexcept(false) { - if (!tile_atlas_array.empty()) [[likely]] - return tile_atlas_array; - tile_atlas_array = json_helper::from_json<std::vector<std::shared_ptr<class tile_atlas>>>( + if (!ground_atlas_array.empty()) [[likely]] + return ground_atlas_array; + ground_atlas_array = json_helper::from_json<std::vector<std::shared_ptr<class ground_atlas>>>( Path::join(loader_::IMAGE_PATH, filename)); - fm_assert(!tile_atlas_array.empty()); - return tile_atlas_array; + fm_assert(!ground_atlas_array.empty()); + return ground_atlas_array; } } // namespace floormat::loader_detail diff --git a/loader/loader.hpp b/loader/loader.hpp index f93e6967..63b5ea5c 100644 --- a/loader/loader.hpp +++ b/loader/loader.hpp @@ -13,7 +13,7 @@ using ImageData2D = ImageData<2>; namespace floormat { -class tile_atlas; +class ground_atlas; class anim_atlas; class wall_atlas; struct scenery_proto; @@ -24,15 +24,15 @@ struct loader_ { virtual StringView shader(StringView filename) noexcept = 0; virtual Trade::ImageData2D texture(StringView prefix, StringView filename, bool fail_ok = true) noexcept(false) = 0; - virtual std::shared_ptr<class tile_atlas> tile_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) = 0; - virtual std::shared_ptr<class tile_atlas> tile_atlas(StringView filename) noexcept(false) = 0; + virtual std::shared_ptr<class ground_atlas> ground_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) = 0; + virtual std::shared_ptr<class ground_atlas> ground_atlas(StringView filename) noexcept(false) = 0; virtual ArrayView<const String> anim_atlas_list() = 0; virtual std::shared_ptr<class anim_atlas> anim_atlas(StringView name, StringView dir = ANIM_PATH) noexcept(false) = 0; virtual std::shared_ptr<class wall_atlas> wall_atlas(StringView name, bool fail_ok = true) noexcept(false) = 0; virtual ArrayView<const wall_info> wall_atlas_list() = 0; static void destroy(); static loader_& default_loader() noexcept; - virtual ArrayView<const std::shared_ptr<class tile_atlas>> tile_atlases(StringView filename) noexcept(false) = 0; + virtual ArrayView<const std::shared_ptr<class ground_atlas>> ground_atlases(StringView filename) noexcept(false) = 0; virtual ArrayView<const serialized_scenery> sceneries() = 0; virtual const scenery_proto& scenery(StringView name) noexcept(false) = 0; virtual StringView startup_directory() noexcept = 0; |