diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-29 14:49:53 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-29 14:49:59 +0100 |
commit | dd7774c77bba183615f1884514a4f3de4e23eb5a (patch) | |
tree | aab90b3152eed45cd8d2aa0c4e97606c7c7c6bea /src/anim-atlas.cpp | |
parent | 1468845c9a7fe9629142227d1bef0302a39fce81 (diff) |
anim, scenery: persist scenery rotation in editor
Diffstat (limited to 'src/anim-atlas.cpp')
-rw-r--r-- | src/anim-atlas.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 10d33bac..e7190df2 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -163,13 +163,19 @@ rotation anim_atlas::prev_rotation_from(rotation r) const noexcept { using ssize = std::make_signed_t<std::size_t>; constexpr auto count = ssize(rotation_COUNT); - for (auto i = ssize(r)-1; i >= 0; i--) - if (_group_indices[std::size_t(i)] != 0xff) - return rotation(i); + if (r < rotation_COUNT) + for (auto i = ssize(r)-1; i >= 0; i--) + if (_group_indices[std::size_t(i)] != 0xff) + return rotation(i); for (auto i = count-1; i >= 0; i--) if (_group_indices[std::size_t(i)] != 0xff) return rotation(i); fm_abort("where did the rotations go?!"); } +bool anim_atlas::check_rotation(rotation r) const noexcept +{ + return r < rotation_COUNT && _group_indices[std::size_t(r)] < 0xff; +} + } // namespace floormat |