summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-23 08:34:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-23 08:34:55 +0100
commit9574e97c4b9b5d607cd95ab81e7d5e8d10487702 (patch)
treeb1cf8c3225b653a201f9c36ad06664e8cc7d1a15 /editor
parente1256c030540d1208349531f8547b1802668f631 (diff)
a
Diffstat (limited to 'editor')
-rw-r--r--editor/tests/pathfinding.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/editor/tests/pathfinding.cpp b/editor/tests/pathfinding.cpp
index 8da64595..042edf01 100644
--- a/editor/tests/pathfinding.cpp
+++ b/editor/tests/pathfinding.cpp
@@ -181,8 +181,8 @@ void pf_test::update_pre(app& a, const Ns& dt)
return;
}
- const auto hz = C.atlas->info().fps;
- const auto nframes = C.alloc_frame_time(dt, C.delta, hz, C.speed);
+ const auto& info = C.atlas->info();
+ const auto nframes = C.alloc_frame_time(dt, C.delta, info.fps, C.speed);
if (nframes == 0)
return;
@@ -216,8 +216,8 @@ void pf_test::update_pre(app& a, const Ns& dt)
fm_assert(step.count > 0);
const auto new_r = dir_from_step(step);
using Frac = decltype(critter::offset_frac)::Type;
- constexpr auto frac = limits<Frac>::max;
- constexpr auto inv_frac = 1.f / float{frac};
+ constexpr auto frac = float{limits<Frac>::max};
+ constexpr auto inv_frac = 1 / frac;
const auto mag = step_magnitude(step.direction);
const auto vec = Vector2(step.direction) * mag;
const auto sign_vec = Math::sign(vec);
@@ -227,10 +227,12 @@ void pf_test::update_pre(app& a, const Ns& dt)
if (!off_i.isZero())
{
- C.offset_frac = Vector2us(Math::abs(Math::fmod(offset_, 1.f)) * frac);
-
+ C.offset_frac = Math::Vector2<Frac>(Math::abs(Math::fmod(offset_, 1.f)) * frac);
if (C.can_move_to(off_i))
+ {
C.move_to(index, off_i, new_r);
+ ++C.frame %= info.nframes;
+ }
else
{
ok = false;
@@ -238,7 +240,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 = Math::Vector2<Frac>(Math::min({1.f,1.f}, Math::abs(offset_)) * frac);
}
if (!ok) [[unlikely]]