Skip to content

Commit

Permalink
clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
jove-m committed Jun 20, 2022
1 parent 7ca8f21 commit d6b5230
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,36 +167,36 @@ bool map::build_transparency_cache( const int zlev )
}
}

for( auto it = cur_submap->vehicles.begin(); it != cur_submap->vehicles.end(); ++it ) {
for( auto &vehicle : cur_submap->vehicles ) {
std::set<point> checked;

auto parts = ( *it )->get_all_parts();
auto parts = vehicle->get_all_parts();

for( auto part = parts.begin(); part != parts.end(); ++part ) {

auto trip = ( *it )->mount_to_tripoint( part->mount() );
auto trip = vehicle->mount_to_tripoint( part->mount() );

for( int dy = -1; dy <= 1; dy++ ) {
for( int dx = -1; dx <= 1; dx++ ) {


tripoint from = { trip.x + dx, trip.y + dy, trip.z };
tripoint from = { trip + point( dx, dy ) };

if( checked.find( {from.x, from.y} ) != checked.end() || from.x < 0 || from.y < 0 ||
if( checked.find( from.xy() ) != checked.end() || from.x < 0 || from.y < 0 ||
from.x >= MAPSIZE_X || from.y >= MAPSIZE_Y ) {
continue;
}
checked.insert( {from.x, from.y} );
checked.insert( from.xy() );


auto from_mount = ( *it )->tripoint_to_mount( from );
auto from_mount = vehicle->tripoint_to_mount( from );

for( int my = -1; my <= 1; my += 2 ) {
for( int mx = -1; mx <= 1; mx += 2 ) {

auto t = ( *it )->tripoint_to_mount( { from.x + mx, from.y + my, from.z } );
auto t = vehicle->tripoint_to_mount( from + point( mx, my ) );

if( !( *it )->allowed_light( t, from_mount ) ) {
if( !vehicle->allowed_light( t, from_mount ) ) {
if( my == -1 && mx == -1 ) {
blocked_cache[from.x][from.y][0] = true;
} else if( my == -1 && mx == 1 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ class map
// Unlike the other caches, this populates a supplied cache instead of an internal cache.
void build_obstacle_cache( const tripoint &start, const tripoint &end,
float( &obstacle_cache )[MAPSIZE_X][MAPSIZE_Y],
bool( &blocked_cache )[MAPSIZE_X][MAPSIZE_Y][2] );
bool( &blocked_obstacle_cache )[MAPSIZE_X][MAPSIZE_Y][2] );

vehicle *add_vehicle( const vgroup_id &type, const tripoint &p, units::angle dir,
int init_veh_fuel = -1, int init_veh_status = -1,
Expand Down
2 changes: 1 addition & 1 deletion tests/explosion_balance_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ TEST_CASE( "rotated_vehicle_walls_block_explosions" )

REQUIRE( veh_pointer_or_null( g->m.veh_at( mon_origin ) ) != nullptr );

tripoint explode_at = mon_origin + tripoint( -1, -1, 0 );
tripoint explode_at = mon_origin + tripoint_north_west;

REQUIRE( veh_pointer_or_null( g->m.veh_at( explode_at ) ) == nullptr );

Expand Down
4 changes: 2 additions & 2 deletions tests/monster_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ TEST_CASE( "monster_move_through_vehicle_holes" )

tripoint mon_origin = origin + tripoint( -2, 1, 0 );
monster &zombie = spawn_test_monster( "mon_zombie", mon_origin );
zombie.move_to( mon_origin + tripoint( -1, -1, 0 ), false, false, 0.0f );
zombie.move_to( mon_origin + tripoint_north_west, false, false, 0.0f );

const monster *m = g->critter_at<monster>( mon_origin );
CHECK( m != nullptr );

const monster *m2 = g->critter_at<monster>( mon_origin + tripoint( -1, -1, 0 ) );
const monster *m2 = g->critter_at<monster>( mon_origin + tripoint_north_west );
CHECK( m2 == nullptr );

}
2 changes: 1 addition & 1 deletion tests/monster_vision_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST_CASE( "monsters_dont_see_through_vehicle_holes", "[vision]" )

monster &inside = spawn_test_monster( "mon_zombie", mon_origin );

tripoint second_origin = mon_origin + tripoint( -1, -1, 0 );
tripoint second_origin = mon_origin + tripoint_north_west;

monster &outside = spawn_test_monster( "mon_zombie", second_origin );

Expand Down
4 changes: 2 additions & 2 deletions tests/npc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,12 @@ TEST_CASE( "npc_move_through_vehicle_holes" )
overmap_buffer.insert_npc( guy );
g->load_npcs();

guy->move_to( mon_origin + tripoint( -1, -1, 0 ), true, nullptr );
guy->move_to( mon_origin + tripoint_north_west, true, nullptr );

const npc *m = g->critter_at<npc>( mon_origin );
CHECK( m != nullptr );

const npc *m2 = g->critter_at<npc>( mon_origin + tripoint( -1, -1, 0 ) );
const npc *m2 = g->critter_at<npc>( mon_origin + tripoint_north_west );
CHECK( m2 == nullptr );

}
2 changes: 1 addition & 1 deletion tests/player_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ TEST_CASE( "player_move_through_vehicle_holes" )

REQUIRE( get_avatar().pos() == pos );

avatar_action::move( get_avatar(), g->m, point( -1, -1 ) );
avatar_action::move( get_avatar(), g->m, point_north_west );

CHECK( get_avatar().pos() == pos );

Expand Down
4 changes: 2 additions & 2 deletions tests/vehicle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ TEST_CASE( "check_vehicle_rotation_against_old" )
const tripoint test_origin( 60, 60, 0 );
const tripoint vehicle_origin = test_origin;
vehicle *veh_ptr = g->m.add_vehicle( vproto_id( "bicycle" ), vehicle_origin, 0_degrees, 0, 0 );
const point pivot( 0, 0 );
const point pivot;

for( int dir = 0; dir < 24; dir++ ) {
for( int x = -5; x <= 5; x++ ) {
Expand All @@ -117,7 +117,7 @@ TEST_CASE( "vehicle_rotation_reverse" )
const tripoint test_origin( 60, 60, 0 );
const tripoint vehicle_origin = test_origin;
vehicle *veh_ptr = g->m.add_vehicle( vproto_id( "bicycle" ), vehicle_origin, 0_degrees, 0, 0 );
const point pivot( 0, 0 );
const point pivot;

for( int dir = 0; dir < 24; dir++ ) {
for( int x = -5; x <= 5; x++ ) {
Expand Down

0 comments on commit d6b5230

Please sign in to comment.