Skip to content

Commit

Permalink
Check to make sure the door is closed, too :(
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Dec 19, 2024
1 parent dc7a8d9 commit 07bb113
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/npc_behavior_rules_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,17 @@ TEST_CASE( "NPC-rules-avoid-locks", "[npc_rules]" )
std::vector<vehicle_part *> door_parts_at_target = test_vehicle->get_parts_at(
car_door_pos, "LOCKABLE_DOOR", part_status_flag::available );
REQUIRE( !door_parts_at_target.empty() );
vehicle_part *door = door_parts_at_target.front();
// The door must be closed for the lock to be effective.
door->open = false;

// NOTE: The door lock is a separate part. We must ensure both the door exists and the door lock exists for this test.
std::vector<vehicle_part *> door_lock_parts_at_target = test_vehicle->get_parts_at(
car_door_pos, "DOOR_LOCKING", part_status_flag::available );
REQUIRE( !door_lock_parts_at_target.empty() );
vehicle_part *door_lock = door_lock_parts_at_target.front();
door_lock->locked = true;
door_lock->open = false;
REQUIRE( ( door_lock->is_available() && door_lock->locked ) );


Expand Down

0 comments on commit 07bb113

Please sign in to comment.