Skip to content

Commit

Permalink
Combined case-branches with same actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed May 31, 2019
1 parent 34eceef commit ede5e42
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 32 deletions.
2 changes: 0 additions & 2 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1573,8 +1573,6 @@ int player::get_total_bionics_slots( const body_part bp ) const
return 18;

case bp_eyes:
return 4;

case bp_mouth:
return 4;

Expand Down
9 changes: 3 additions & 6 deletions src/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2214,14 +2214,11 @@ void map::player_in_field( player &u )
}
break;

//Why do these get removed???
// Why do these get removed???
// Stepping on a shock vent shuts it down.
case fd_shock_vent:
//Stepping on a shock vent shuts it down.
cur.setFieldDensity( 0 );
continue;

// Stepping on an acid vent shuts it down.
case fd_acid_vent:
//Stepping on an acid vent shuts it down.
cur.setFieldDensity( 0 );
continue;

Expand Down
2 changes: 0 additions & 2 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,6 @@ void iexamine::cardreader_robofac( player &p, const tripoint &examp )
} else {
switch( hack_attempt( p ) ) {
case HACK_FAIL:
add_msg( _( "Nothing happens." ) );
break;
case HACK_NOTHING:
add_msg( _( "Nothing happens." ) );
break;
Expand Down
1 change: 0 additions & 1 deletion src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,6 @@ void input_manager::wait_for_any_key()
while( true ) {
switch( inp_mngr.get_input_event().type ) {
case CATA_INPUT_KEYBOARD:
return;
// errors are accepted as well to avoid an infinite loop
case CATA_INPUT_ERROR:
return;
Expand Down
6 changes: 1 addition & 5 deletions src/mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,8 @@ bool mission::is_complete( const int _npc_id ) const
return npc_id == _npc_id;

case MGOAL_ASSASSINATE:
return step >= 1;

case MGOAL_KILL_MONSTER:
case MGOAL_COMPUTER_TOGGLE:
return step >= 1;

case MGOAL_KILL_MONSTER_TYPE:
Expand All @@ -412,9 +411,6 @@ bool mission::is_complete( const int _npc_id ) const
case MGOAL_KILL_MONSTER_SPEC:
return g->kill_count( monster_species ) >= kill_count_to_reach;

case MGOAL_COMPUTER_TOGGLE:
return step >= 1;

default:
return false;
}
Expand Down
2 changes: 0 additions & 2 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,6 @@ int monster::get_armor_type( damage_type dt, body_part bp ) const

switch( dt ) {
case DT_TRUE:
return 0;
case DT_BIOLOGICAL:
return 0;
case DT_BASH:
Expand All @@ -1627,7 +1626,6 @@ int monster::get_armor_type( damage_type dt, body_part bp ) const
case DT_HEAT:
return worn_armor + static_cast<int>( type->armor_fire );
case DT_COLD:
return worn_armor;
case DT_ELECTRIC:
return worn_armor;
case DT_NULL:
Expand Down
10 changes: 1 addition & 9 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,7 @@ struct points_left {
}

int skill_points_left() const {
switch( limit ) {
case FREEFORM:
case ONE_POOL:
return stat_points + trait_points + skill_points;
case MULTI_POOL:
return stat_points + trait_points + skill_points;
}

return 0;
return stat_points + trait_points + skill_points;
}

bool is_freeform() {
Expand Down
5 changes: 1 addition & 4 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3404,9 +3404,7 @@ dealt_damage_instance player::deal_damage( Creature *source, body_part bp,
break;
case bp_hand_l: // Fall through to arms
case bp_arm_l:
// Hit to arms/hands are really bad to our aim
recoil_mul = 200;
break;
// Hit to arms/hands are really bad to our aim
case bp_hand_r: // Fall through to arms
case bp_arm_r:
recoil_mul = 200;
Expand Down Expand Up @@ -10210,7 +10208,6 @@ int player::get_armor_type( damage_type dt, body_part bp ) const
{
switch( dt ) {
case DT_TRUE:
return 0;
case DT_BIOLOGICAL:
return 0;
case DT_BASH:
Expand Down
1 change: 0 additions & 1 deletion src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ double Creature::ranged_target_size() const
if( has_flag( MF_HARDTOSHOOT ) ) {
switch( get_size() ) {
case MS_TINY:
return occupied_tile_fraction( MS_TINY );
case MS_SMALL:
return occupied_tile_fraction( MS_TINY );
case MS_MEDIUM:
Expand Down

0 comments on commit ede5e42

Please sign in to comment.