summaryrefslogtreecommitdiffhomepage
path: root/editor/scenery-editor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-14 07:33:47 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-14 07:33:47 +0100
commitdc5e66b5a29fd7de8ddf59852ceefd982289b7c3 (patch)
tree18bf0a274f1595d6d2d6cfb32a3b3825d843e315 /editor/scenery-editor.cpp
parent29bdd5f2170b9d46a8b3b0973c4c0845d6a2b61e (diff)
a
Diffstat (limited to 'editor/scenery-editor.cpp')
-rw-r--r--editor/scenery-editor.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp
index 1d0635a6..9e9aa47b 100644
--- a/editor/scenery-editor.cpp
+++ b/editor/scenery-editor.cpp
@@ -22,7 +22,7 @@ scenery_editor::scenery_editor() noexcept
void scenery_editor::set_rotation(rotation_ r)
{
- auto& s = _selected.proto.frame;
+ auto& s = _selected.proto;
s.bbox_offset = rotate_point(s.bbox_offset, s.r, r);
s.bbox_size = rotate_size(s.bbox_size, s.r, r);
s.r = r;
@@ -30,24 +30,24 @@ void scenery_editor::set_rotation(rotation_ r)
rotation_ scenery_editor::rotation() const
{
- return _selected.proto.frame.r;
+ return _selected.proto.r;
}
void scenery_editor::next_rotation()
{
- set_rotation(_selected.proto.atlas->next_rotation_from(_selected.proto.frame.r));
+ set_rotation(_selected.proto.atlas->next_rotation_from(_selected.proto.r));
}
void scenery_editor::prev_rotation()
{
- set_rotation(_selected.proto.atlas->prev_rotation_from(_selected.proto.frame.r));
+ set_rotation(_selected.proto.atlas->prev_rotation_from(_selected.proto.r));
}
void scenery_editor::select_tile(const scenery_& s)
{
- const auto r = s.proto.atlas && s.proto.atlas->check_rotation(_selected.proto.frame.r)
- ? _selected.proto.frame.r
- : s.proto.frame.r;
+ const auto r = s.proto.atlas && s.proto.atlas->check_rotation(_selected.proto.r)
+ ? _selected.proto.r
+ : s.proto.r;
_selected = s;
set_rotation(r);
}
@@ -80,7 +80,8 @@ bool scenery_editor::is_anything_selected() const
void scenery_editor::place_tile(world& w, global_coords pos, const scenery_& s)
{
auto [c, t] = w[pos];
- t.scenery() = s.proto;
+ // todo check collision at pos
+ auto sc = w.make_entity<scenery>(pos, s.proto);
c.mark_scenery_modified();
}