diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-22 10:45:33 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-22 10:45:33 +0100 |
commit | 0cd4975e059cd822fa0cb63203844156df7bf6b7 (patch) | |
tree | 1c9321f5e95dc919a40aa3019507f0899dcdeae3 /editor | |
parent | 41282923d0dad390cd9bc1d1025f7dde801899d5 (diff) |
w
Diffstat (limited to 'editor')
-rw-r--r-- | editor/tests/pathfinding.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/editor/tests/pathfinding.cpp b/editor/tests/pathfinding.cpp index 8fba119b..3e77cdcf 100644 --- a/editor/tests/pathfinding.cpp +++ b/editor/tests/pathfinding.cpp @@ -172,21 +172,25 @@ void pf_test::update_pre(app& a, const Ns& dt) return; } const auto step = next_step(from, current.dest); - Debug{} << "step" << step.direction << step.count; + //Debug{} << "step" << step.direction << step.count << "frames" << i << "/" << nframes; C.set_keys_auto(); if (step.direction == Vector2b{}) { + Debug{} << "no dir break"; ok = false; break; } fm_assert(step.count > 0); using Frac = decltype(critter::offset_frac)::Type; - constexpr auto inv_frac = 1.f / (float)unsigned{limits<Frac>::max}; - const auto vec = Vector2(step.direction) * step_magnitude(step.direction); + constexpr auto inv_frac = 1.f / float{limits<Frac>::max}; + const auto mag = step_magnitude(step.direction); + const auto vec = Vector2(step.direction) * mag; const auto sign_vec = Math::sign(vec); const auto frac = Vector2(C.offset_frac) * sign_vec * inv_frac; - auto offset_ = vec + frac; - auto off_i = Vector2i(offset_); + auto offsetʹ = vec + frac; + auto off_i = Vector2i(offsetʹ); + Debug{} << "vec" << vec << "mag" << mag << "frac" << frac; + if (!off_i.isZero()) { if (C.can_move_to(off_i)) @@ -198,7 +202,7 @@ void pf_test::update_pre(app& a, const Ns& dt) } } else - C.offset_frac = Vector2us(Math::min({1.f,1.f}, Math::abs(offset_)) * frac); + C.offset_frac = Vector2us(Math::min({1.f,1.f}, Math::abs(offsetʹ)) * frac); } if (!ok) [[unlikely]] |