From 56b5489bdea839eb24165a86e937a29b9a42a39f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Dec 2022 14:37:00 +0100 Subject: editor: allow rotating already placed scenery --- editor/update.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/editor/update.cpp b/editor/update.cpp index 4dde4ffc..972af56e 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -1,6 +1,7 @@ #include "app.hpp" #include "src/world.hpp" #include "src/tile-atlas.hpp" +#include "src/anim-atlas.hpp" #include "main/clickable.hpp" #include "floormat/events.hpp" #include "floormat/main.hpp" @@ -94,7 +95,21 @@ void app::do_key(key k, int mods) if (auto* ed = _editor.current_tile_editor()) ed->toggle_rotation(); else if (auto* ed = _editor.current_scenery_editor()) - ed->next_rotation(); + { + if (ed->is_anything_selected()) + ed->next_rotation(); + else if (cursor.tile) + { + auto [c, t] = M->world()[*cursor.tile]; + if (auto [atlas, s] = t.scenery(); atlas) + { + auto old_r = s.r; + s.r = atlas->next_rotation_from(s.r); + if (s.r != old_r) + c.mark_scenery_modified(); + } + } + } return; case key_mode_none: return _editor.set_mode(editor_mode::none); -- cgit v1.2.3