Browse files

Prevent rare npc-movement test failure

One of the NPC movement tests checks that an NPC in a vehicle on
hazardous terrain does not move.  The intention is that the NPC should
not be fleeing the hazardous terrain.  Unfortunately there are other
reasons why NPCs may move (such as long-term goals to acquire ammo

Resolve this by giving the NPCs in the test a mission which causes them
to stay still unless in peril.
  • Loading branch information...
jbytheway committed Jan 4, 2019
1 parent 5a77965 commit 7e08b8f5d17d5d967a6f9c5e1608425f2f6a7098
Showing with 4 additions and 0 deletions.
  1. +4 −0 tests/npc_test.cpp
@@ -352,6 +352,10 @@ TEST_CASE( "npc-movement" )
guy->spawn_at_precise( {g->get_levx(), g->get_levy()}, p );
// Set the shopkeep mission; this means that
// the NPC deems themselves to be guarding and stops them
// wandering off in search of distant ammo caches, etc.
guy->mission = NPC_MISSION_SHOPKEEP;
overmap_buffer.insert_npc( guy );
guy->set_attitude( ( type == 'M' || type == 'C' ) ? NPCATT_NULL : NPCATT_FOLLOW );

0 comments on commit 7e08b8f

Please sign in to comment.