From c93b3616adbf26673fc928fdfbbec814fec41c75 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 11 Jan 2024 18:15:00 +0100 Subject: w --- editor/ground-editor.cpp | 13 ++++++------- editor/ground-editor.hpp | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'editor') diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp index 2a74952c..f88bc25a 100644 --- a/editor/ground-editor.cpp +++ b/editor/ground-editor.cpp @@ -2,6 +2,7 @@ #include "src/ground-atlas.hpp" #include "src/world.hpp" #include "src/random.hpp" +#include "loader/ground-info.hpp" #include "keys.hpp" #include "loader/loader.hpp" #include "compat/exception.hpp" @@ -17,18 +18,16 @@ ground_editor::ground_editor() void ground_editor::load_atlases() { - for (const auto& atlas : loader.ground_atlases("ground.json"_s)) - { - auto& [_, vec] = _permutation; - vec.reserve(atlas->num_tiles()); - _atlases[atlas->name()] = atlas; - } + fm_assert(_atlases.empty()); + for (const auto& g : loader.ground_atlas_list()) + _atlases[g.name] = &g; + fm_assert(!_atlases.empty()); } std::shared_ptr ground_editor::maybe_atlas(StringView str) { if (auto it = _atlases.find(str); it != _atlases.end()) - return it->second; + return it->second->atlas; else return nullptr; } diff --git a/editor/ground-editor.hpp b/editor/ground-editor.hpp index 46c9dc3a..9ff9a198 100644 --- a/editor/ground-editor.hpp +++ b/editor/ground-editor.hpp @@ -11,6 +11,7 @@ namespace floormat { struct world; +struct ground_info; class ground_editor final { @@ -23,7 +24,7 @@ class ground_editor final std::vector variant; }; - std::map> _atlases; + std::map _atlases; tile_image_proto _selected_tile; tuple _permutation; selection_mode _selection_mode = sel_none; -- cgit v1.2.3