From ede5e428b96fe5511a8306190852661811300c2d Mon Sep 17 00:00:00 2001 From: ZhilkinSerg Date: Fri, 31 May 2019 10:35:25 +0300 Subject: [PATCH] Combined case-branches with same actions --- src/bionics.cpp | 2 -- src/field.cpp | 9 +++------ src/iexamine.cpp | 2 -- src/input.cpp | 1 - src/mission.cpp | 6 +----- src/monster.cpp | 2 -- src/newcharacter.cpp | 10 +--------- src/player.cpp | 5 +---- src/ranged.cpp | 1 - 9 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/bionics.cpp b/src/bionics.cpp index 6c7a19f523c9..834bde906e0d 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -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; diff --git a/src/field.cpp b/src/field.cpp index 7fd6384a4f4f..21bf71ec4687 100644 --- a/src/field.cpp +++ b/src/field.cpp @@ -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; diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 19ac591cc143..06d4b74a099b 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -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; diff --git a/src/input.cpp b/src/input.cpp index fcf4683527c3..5f05590dc903 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -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; diff --git a/src/mission.cpp b/src/mission.cpp index 7d39df00f70e..19f9cf48fcdc 100644 --- a/src/mission.cpp +++ b/src/mission.cpp @@ -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: @@ -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; } diff --git a/src/monster.cpp b/src/monster.cpp index 28fcf38d38a1..8879ae2b9ca5 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -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: @@ -1627,7 +1626,6 @@ int monster::get_armor_type( damage_type dt, body_part bp ) const case DT_HEAT: return worn_armor + static_cast( type->armor_fire ); case DT_COLD: - return worn_armor; case DT_ELECTRIC: return worn_armor; case DT_NULL: diff --git a/src/newcharacter.cpp b/src/newcharacter.cpp index 4a995b897d40..56c993aa5704 100644 --- a/src/newcharacter.cpp +++ b/src/newcharacter.cpp @@ -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() { diff --git a/src/player.cpp b/src/player.cpp index fbb88e4bbe22..6806ff0058a2 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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; @@ -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: diff --git a/src/ranged.cpp b/src/ranged.cpp index 1f9d74bff5b5..f9e47f17f286 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -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: