summaryrefslogtreecommitdiffhomepage
path: root/editor/tests
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-23 05:58:57 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-23 07:42:30 +0100
commit600a79ba00f58936b1d1d509837262c2895a7c0a (patch)
treeb1cacf9048d0e700dda12522fbc3b62822db7bd4 /editor/tests
parentc69de61bf3873e5de4bb035ee965881a99789142 (diff)
src/critter: fix stopping auto movement
Diffstat (limited to 'editor/tests')
-rw-r--r--editor/tests/pathfinding.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/editor/tests/pathfinding.cpp b/editor/tests/pathfinding.cpp
index cba3f405..f8964c94 100644
--- a/editor/tests/pathfinding.cpp
+++ b/editor/tests/pathfinding.cpp
@@ -149,6 +149,12 @@ void pf_test::update_pre(app& a, const Ns& dt)
auto& C = *a.ensure_player_character(m.world()).ptr;
fm_assert(C.is_dynamic());
+ if (C.movement.L | C.movement.R | C.movement.U | C.movement.D) [[unlikely]]
+ {
+ current.has_value = false;
+ return;
+ }
+
const auto hz = C.atlas->info().fps;
const auto nframes = C.alloc_frame_time(dt, C.delta, hz, C.speed);
@@ -169,6 +175,7 @@ void pf_test::update_pre(app& a, const Ns& dt)
{
current.has_value = false;
Debug{} << "done!" << from;
+ C.set_keys(false, false, false, false);
return;
}
const auto step = next_step(from, current.dest);
@@ -209,8 +216,10 @@ void pf_test::update_pre(app& a, const Ns& dt)
if (!ok) [[unlikely]]
{
+ C.set_keys(false, false, false, false);
C.delta = {};
C.offset_frac = {};
+ current.has_value = false;
}
}