From 315ea057fef52d6261924b4aa28b75116e57b043 Mon Sep 17 00:00:00 2001 From: Richard Fine Date: Tue, 1 Jan 2019 14:52:56 +0000 Subject: [PATCH] Verify that peeps stay on paths As per PR recommendation, confirm that a peep is still on the footpath for every step of the pathfinding tests. --- test/tests/Pathfinding.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 40be195863..17e6ffffb4 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -117,6 +117,10 @@ protected: pos->z = peep->z / 8; EXPECT_PRED_FORMAT1(AssertIsNotForbiddenPosition, *pos); + + // Check that the peep is still on a footpath. Use next_z instead of pos->z here because pos->z will change + // when the peep is halfway up a slope, but next_z will not change until they move to the next tile. + EXPECT_NE(map_get_footpath_element(pos->x, pos->y, peep->next_z), nullptr); } // Clean up the peep, because we're reusing this loaded context for all tests.