diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/ground-editor.cpp | 5 | ||||
-rw-r--r-- | editor/ground-editor.hpp | 4 | ||||
-rw-r--r-- | editor/imgui-editors.cpp | 12 | ||||
-rw-r--r-- | editor/wall-editor.cpp | 2 | ||||
-rw-r--r-- | editor/wall-editor.hpp | 4 |
5 files changed, 15 insertions, 12 deletions
diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp index 82a76405..653ad122 100644 --- a/editor/ground-editor.cpp +++ b/editor/ground-editor.cpp @@ -30,7 +30,10 @@ void ground_editor::load_atlases() fm_assert(_atlases.empty()); for (const auto& g : loader.ground_atlas_list()) { - (void)loader.ground_atlas(g.name); + if (g.name != loader.INVALID) [[likely]] + (void)loader.ground_atlas(g.name); + else + loader.make_invalid_ground_atlas(); fm_assert(g.atlas); _atlases[g.name] = &g; } diff --git a/editor/ground-editor.hpp b/editor/ground-editor.hpp index a0d99813..a7de3333 100644 --- a/editor/ground-editor.hpp +++ b/editor/ground-editor.hpp @@ -10,14 +10,14 @@ namespace floormat { class world; -struct ground_info; +struct ground_cell; class ground_editor final { enum selection_mode : unsigned char { sel_none, sel_tile, sel_perm, }; struct tuple; - std::map<StringView, const ground_info*> _atlases; + std::map<StringView, const ground_cell*> _atlases; tile_image_proto _selected_tile; safe_ptr<tuple> _permutation; selection_mode _selection_mode = sel_none; diff --git a/editor/imgui-editors.cpp b/editor/imgui-editors.cpp index 570094bc..efb37426 100644 --- a/editor/imgui-editors.cpp +++ b/editor/imgui-editors.cpp @@ -39,23 +39,23 @@ StringView scenery_type_to_string(const scenery_& sc) } } -StringView scenery_path(const wall_info* wa) { return wa->atlas->name(); } +StringView scenery_path(const wall_cell* wa) { return wa->atlas->name(); } StringView scenery_name(StringView, const scenery_& sc) { return sc.name; } StringView scenery_name(StringView, const vobj_& vobj) { return vobj.descr; } -StringView scenery_name(StringView, const wall_info* w) { return w->name; } +StringView scenery_name(StringView, const wall_cell* w) { return w->name; } std::shared_ptr<anim_atlas> get_atlas(const scenery_& sc) { return sc.proto.atlas; } std::shared_ptr<anim_atlas> get_atlas(const vobj_& vobj) { return vobj.factory->atlas(); } -std::shared_ptr<wall_atlas> get_atlas(const wall_info* w) { return loader.wall_atlas(w->name); } +std::shared_ptr<wall_atlas> get_atlas(const wall_cell* w) { return loader.wall_atlas(w->name); } Vector2ui get_size(const auto&, anim_atlas& atlas) { return atlas.frame(atlas.first_rotation(), 0).size; } Vector2ui get_size(const auto&, wall_atlas& atlas) { auto sz = atlas.image_size(); return { std::max(1u, std::min(sz.y()*3/2, sz.x())), sz.y() }; } bool is_selected(const scenery_editor& ed, const scenery_& sc) { return ed.is_item_selected(sc); } bool is_selected(const vobj_editor& vo, const vobj_& sc) { return vo.is_item_selected(sc); } -bool is_selected(const wall_editor& wa, const wall_info* sc) { return wa.is_atlas_selected(sc->atlas); } +bool is_selected(const wall_editor& wa, const wall_cell* sc) { return wa.is_atlas_selected(sc->atlas); } void select_tile(scenery_editor& ed, const scenery_& sc) { ed.select_tile(sc); } void select_tile(vobj_editor& vo, const vobj_& sc) { vo.select_tile(sc); } -void select_tile(wall_editor& wa, const wall_info* sc) { wa.select_atlas(sc->atlas); } +void select_tile(wall_editor& wa, const wall_cell* sc) { wa.select_atlas(sc->atlas); } auto get_texcoords(const auto&, anim_atlas& atlas) { return atlas.texcoords_for_frame(atlas.first_rotation(), 0, !atlas.group(atlas.first_rotation()).mirror_from.isEmpty()); } -auto get_texcoords(const wall_info* w, wall_atlas& atlas) { auto sz = get_size(w, atlas); return Quads::texcoords_at({}, sz, atlas.image_size()); } +auto get_texcoords(const wall_cell* w, wall_atlas& atlas) { auto sz = get_size(w, atlas); return Quads::texcoords_at({}, sz, atlas.image_size()); } void draw_editor_tile_pane_atlas(ground_editor& ed, StringView name, const std::shared_ptr<ground_atlas>& atlas, Vector2 dpi) { diff --git a/editor/wall-editor.cpp b/editor/wall-editor.cpp index f3e0b13f..681397a5 100644 --- a/editor/wall-editor.cpp +++ b/editor/wall-editor.cpp @@ -3,7 +3,7 @@ #include "src/wall-atlas.hpp" #include "src/world.hpp" #include "loader/loader.hpp" -#include "loader/wall-info.hpp" +#include "loader/wall-cell.hpp" #include <Corrade/Containers/ArrayView.h> namespace floormat { diff --git a/editor/wall-editor.hpp b/editor/wall-editor.hpp index 159135a0..b58dd72a 100644 --- a/editor/wall-editor.hpp +++ b/editor/wall-editor.hpp @@ -2,7 +2,7 @@ #include "editor-enums.hpp" #include "src/rotation.hpp" #include "src/global-coords.hpp" -#include "loader/wall-info.hpp" +#include "loader/wall-cell.hpp" #include <memory> #include <map> @@ -13,7 +13,7 @@ class wall_atlas; class wall_editor { - std::map<StringView, const wall_info*> _atlases; + std::map<StringView, const wall_cell*> _atlases; std::shared_ptr<wall_atlas> _selected_atlas; enum rotation _r = rotation::N; |