Skip to content

Commit

Permalink
Fix various clang-tidy errors
Browse files Browse the repository at this point in the history
Having fixed the clang-tidy Travis build, it's now necessary to fix all
the errors it highlights.
  • Loading branch information
jbytheway committed Dec 15, 2019
1 parent 976d99b commit 6f8d980
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 18 deletions.
5 changes: 1 addition & 4 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,7 @@ void Character::set_stashed_activity( player_activity act, player_activity act_b

bool Character::has_stashed_activity() const
{
if( stashed_outbounds_activity ) {
return true;
}
return false;
return static_cast<bool>( stashed_outbounds_activity );
}

void Character::assign_stashed_activity()
Expand Down
4 changes: 2 additions & 2 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,9 @@ static void sleep()

as_m.reset();
as_m.text = can_hibernate ?
_( "You're engorged to hibernate. The alarm would only attract attention. Set an alarm anyway?" +
_( "You're engorged to hibernate. The alarm would only attract attention. Set an alarm anyway?" +
deaf_text ) :
_( "You have an alarm clock. Set an alarm?" + deaf_text );
_( "You have an alarm clock. Set an alarm?" + deaf_text );

as_m.entries.emplace_back( 0, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'N' : 'n',
Expand Down
2 changes: 1 addition & 1 deletion src/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ number_sci_notation JsonIn::get_any_int()
error( "Integers cannot have a decimal point or negative order of magnitude." );
}
// Manually apply scientific notation, since std::pow converts to double under the hood.
for( int i = 0; i < n.exp; i++ ) {
for( int64_t i = 0; i < n.exp; i++ ) {
if( n.number > std::numeric_limits<uint64_t>::max() / 10ULL ) {
error( "Specified order of magnitude too large -- encountered overflow applying it." );
}
Expand Down
4 changes: 2 additions & 2 deletions src/mapgen_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2293,17 +2293,17 @@ void mapgen_generic_house( mapgendata &dat, int variant )

// West external wall
lw = rng( 0, 4 );
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
// Middle wall between bedroom & kitchen/bath
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
mw = lw + rng( 7, 10 );
// East external wall
rw = SEEX * 2 - rng( 1, 5 );
// North external wall
tw = rng( 1, 6 );
// South external wall
bw = SEEX * 2 - rng( 2, 5 );
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
// Middle wall between living room & kitchen/bed
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores)
cw = tw + rng( 4, 7 );
//reserving some space for backyard. Actual south external wall.
actual_house_height = bw - rng( 4, 6 );
Expand Down
2 changes: 0 additions & 2 deletions src/mondefense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
static const skill_id skill_gun( "gun" );
static const skill_id skill_rifle( "rifle" );

std::vector<tripoint> closest_tripoints_first( int radius, const tripoint &p );

void mdefense::none( monster &, Creature *, const dealt_projectile_attack * )
{
}
Expand Down
2 changes: 0 additions & 2 deletions src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,12 +804,10 @@ void npc::move()
if( has_stashed_activity() ) {
if( !check_outbounds_activity( get_stashed_activity(), true ) ) {
assign_stashed_activity();
action = npc_player_activity;
} else {
// wait a turn, because next turn, the object of our activity
// may have been loaded in.
set_moves( 0 );
action = npc_pause;
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/player_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ static void draw_stats_tab( const catacurses::window &w_stats, const catacurses:
const int lines = fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_magenta,
_( "Your weight is a general indicator of how much fat your body has stored up,"
" which in turn shows how prepared you are to survive for a time without food."
" Having too much, or too little, can be unhealthy." ) );
" Having too much, or too little, can be unhealthy." ) );
fold_and_print( w_info, point( 1, 1 + lines ), FULL_SCREEN_WIDTH - 2, c_magenta,
you.get_weight_description() );
}
Expand Down
3 changes: 0 additions & 3 deletions src/veh_interact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,11 @@ static auto can_refill = []( const vehicle_part &pt )
return pt.can_reload();
};

namespace
{
static const quality_id LIFT( "LIFT" );
static const quality_id JACK( "JACK" );
static const quality_id SELF_JACK( "SELF_JACK" );
static const skill_id skill_mechanics( "mechanics" );
static const itype_id fuel_type_battery( "battery" );
} // namespace

void act_vehicle_siphon( vehicle *veh );
void act_vehicle_unload_fuel( vehicle *veh );
Expand Down
2 changes: 1 addition & 1 deletion tests/active_item_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_CASE( "place_active_item_at_various_coordinates", "[item]" )
CHECK( !g->m.get_submaps_with_active_items().empty() );
CHECK( g->m.get_submaps_with_active_items().find( abs_loc ) !=
g->m.get_submaps_with_active_items().end() );
CHECK( g->m.i_at( { x, y, z } ).size() != 0 );
CHECK( !g->m.i_at( { x, y, z } ).empty() );
g->m.i_clear( { x, y, z } );
}
}
Expand Down

0 comments on commit 6f8d980

Please sign in to comment.