summaryrefslogtreecommitdiffhomepage
path: root/editor/update.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-12-09 14:37:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-12-09 14:37:07 +0100
commit56b5489bdea839eb24165a86e937a29b9a42a39f (patch)
tree120a7ccf65f0cf6bf630332c9f0dcf34ce41bdc1 /editor/update.cpp
parent64ad9c57f1b39f6d35f5187992b4d3fb5b7d087f (diff)
editor: allow rotating already placed scenery
Diffstat (limited to 'editor/update.cpp')
-rw-r--r--editor/update.cpp17
1 files changed, 16 insertions, 1 deletions
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);