diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 18:48:09 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 18:50:26 +0100 |
commit | 9fb948dcc12c82902c4876e886f388023c0350f6 (patch) | |
tree | 5a08746056d0683b3e4788cbfc368aa1e9f9a1d9 /src | |
parent | 7d4e9ea953ec8d21abf8740f720c1bea95b8aaeb (diff) |
try to fix osx build
Diffstat (limited to 'src')
-rw-r--r-- | src/critter.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/critter.cpp b/src/critter.cpp index d2e17dac..82a518c6 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -136,10 +136,17 @@ bool update_movement_1(critter& C, size_t& i, const anim_def& info, uint32_t nfr { for (auto k = 0u; k < nframes; k++) { - constexpr auto rotations = rotation_to_similar(new_r); - if (constexpr auto vec = rotation_to_vec(rotations[0]); update_movement_body<rotations[0], vec.x(), vec.y()>(i, C, info)) continue; - if (constexpr auto vec = rotation_to_vec(rotations[1]); update_movement_body<rotations[1], vec.x(), vec.y()>(i, C, info)) continue; - if (constexpr auto vec = rotation_to_vec(rotations[2]); update_movement_body<rotations[2], vec.x(), vec.y()>(i, C, info)) continue; + constexpr auto fun = []<size_t k>(size_t& index, critter& C, const anim_def& info) { + constexpr auto rotations = rotation_to_similar(new_r); + constexpr auto vec = rotation_to_vec(rotations[k]); + constexpr auto vx = vec.x(), vy = vec.y(); + return update_movement_body<rotations[k], vx, vy>(index, C, info); + }; + + if (fun.template operator()<0>(i, C, info)) continue; + if (fun.template operator()<1>(i, C, info)) continue; + if (fun.template operator()<2>(i, C, info)) continue; + return false; } } |