From 9fb948dcc12c82902c4876e886f388023c0350f6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 23 Mar 2024 18:48:09 +0100 Subject: try to fix osx build --- src/critter.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') 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(i, C, info)) continue; - if (constexpr auto vec = rotation_to_vec(rotations[1]); update_movement_body(i, C, info)) continue; - if (constexpr auto vec = rotation_to_vec(rotations[2]); update_movement_body(i, C, info)) continue; + constexpr auto fun = [](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(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; } } -- cgit v1.2.3