Skip to content

Commit

Permalink
Potential fix for ordering issues
Browse files Browse the repository at this point in the history
+ Clean up some UB
+ Remove now misleading comment
  • Loading branch information
RenechCDDA committed Dec 14, 2024
1 parent 5cb038b commit 69dc9f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/npc_behavior_rules_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static shared_ptr_fast<npc> setup_generic_rules_test( ally_rule rule_to_test,
update_mapgen_id update_mapgen_id_to_apply )
{
clear_map();
clear_vehicles();
clear_avatar();
Character &player = get_player_character();
tripoint_bub_ms next_to = player.pos_bub() + point::north;
Expand Down Expand Up @@ -224,15 +225,14 @@ TEST_CASE( "NPC-rules-avoid-locks", "[npc_rules]" )
const tripoint_bub_ms outside_car_door_pos = car_door_pos + point::north;


// all sides of the vehicle are locked doors
vehicle *test_vehicle = here.add_vehicle( vehicle_prototype_locked_as_hell_car,
car_center_pos, 0_degrees, 0, 0 );

// vehicle is a 5x5 grid, car_door_pos is the only door/exit
std::vector<vehicle_part *> parts_at_target = test_vehicle->get_parts_at(
car_door_pos, "LOCKABLE_DOOR", part_status_flag::available );
vehicle_part *door = parts_at_target.front();
REQUIRE( !parts_at_target.empty() );
vehicle_part *door = parts_at_target.front();

// NOTE: The door lock is a separate part. We must ensure both the door exists and the door lock exists for this test.
const int door_index = test_vehicle->index_of_part( door );
Expand Down

0 comments on commit 69dc9f7

Please sign in to comment.