summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/ground-editor.cpp13
-rw-r--r--editor/ground-editor.hpp3
2 files changed, 8 insertions, 8 deletions
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_atlas> 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<decltype(tile_image_proto::variant)> variant;
};
- std::map<StringView, std::shared_ptr<ground_atlas>> _atlases;
+ std::map<StringView, const ground_info*> _atlases;
tile_image_proto _selected_tile;
tuple _permutation;
selection_mode _selection_mode = sel_none;