diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-05 06:31:28 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-12-05 06:31:28 +0100 |
commit | 2e72c24867e74b057915d2fbc203a72d44e2a7e3 (patch) | |
tree | be1fffbfeae58a5c74f6d4ace6899e6253c38152 | |
parent | 960e346159dbf152d9847f0998e1e717fb7dbfef (diff) |
loader: reserve the right size for anim atlas list
-rw-r--r-- | loader/atlas.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp index 1354e922..d39a0c40 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -84,13 +84,15 @@ std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name, StringView void loader_impl::get_anim_atlas_list() { anim_atlases.clear(); - anim_atlases.reserve(64); using f = Path::ListFlag; constexpr auto flags = f::SkipDirectories | f::SkipDotAndDotDot | f::SkipSpecial | f::SortAscending; if (const auto list = Path::list(ANIM_PATH, flags); list) + { + anim_atlases.reserve(list->size()*2); for (StringView str : *list) if (str.hasSuffix(".json")) anim_atlases.emplace_back(str.exceptSuffix(std::size(".json")-1)); + } } bool loader_impl::check_atlas_name(StringView str) |