From 9f1ad48bcc09ecf0a81a2c46bf4a1e36a57c78a6 Mon Sep 17 00:00:00 2001 From: ZhilkinSerg Date: Thu, 11 Jul 2019 12:52:29 +0300 Subject: [PATCH] Removed redundant parentheses --- src/event.cpp | 4 ++-- src/grab.cpp | 4 ++-- src/help.cpp | 2 +- src/iuse_software_snake.cpp | 4 ++-- src/mutation_data.cpp | 2 +- src/mutation_ui.cpp | 8 +++---- src/vehicle_display.cpp | 8 +++---- src/vehicle_part.cpp | 6 ++--- src/weather.cpp | 44 ++++++++++++++++++------------------- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/event.cpp b/src/event.cpp index c459f57c4873d..87dd8e175e934 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -53,8 +53,8 @@ void event::actualize() g->u.add_memorial_log( pgettext( "memorial_male", "Became wanted by the police!" ), pgettext( "memorial_female", "Became wanted by the police!" ) ); - int robx = ( u_pos.x > map_point.x ? 0 - SEEX * 2 : SEEX * 4 ); - int roby = ( u_pos.y > map_point.y ? 0 - SEEY * 2 : SEEY * 4 ); + int robx = u_pos.x > map_point.x ? 0 - SEEX * 2 : SEEX * 4; + int roby = u_pos.y > map_point.y ? 0 - SEEY * 2 : SEEY * 4; g->summon_mon( robot_type, tripoint( robx, roby, g->u.posz() ) ); } } diff --git a/src/grab.cpp b/src/grab.cpp index 3fb1c046b1042..00ab4a19149ae 100644 --- a/src/grab.cpp +++ b/src/grab.cpp @@ -62,8 +62,8 @@ bool game::grabbed_veh_move( const tripoint &dp ) next_grab.x != 0 && next_grab.y != 0 ) { // Zig-zag (or semi-zig-zag) pull: player is diagonal to vehicle // and moves away from it, but not directly away - dp_veh.x = ( dp.x == -dp_veh.x ) ? 0 : dp_veh.x; - dp_veh.y = ( dp.y == -dp_veh.y ) ? 0 : dp_veh.y; + dp_veh.x = dp.x == -dp_veh.x ? 0 : dp_veh.x; + dp_veh.y = dp.y == -dp_veh.y ? 0 : dp_veh.y; next_grab = -dp_veh; zigzag = true; diff --git a/src/help.cpp b/src/help.cpp index bfb6c69239c7f..c9b9cbc6688b0 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -107,7 +107,7 @@ Press ESC to return to the game." ) ) + 1; second_column = std::max( second_column, utf8_width( cat_name ) + 4 ); } - shortcut_print( win, y + i % half_size, ( i < half_size ? 1 : second_column ), + shortcut_print( win, y + i % half_size, i < half_size ? 1 : second_column, c_white, c_light_blue, cat_name ); } diff --git a/src/iuse_software_snake.cpp b/src/iuse_software_snake.cpp index 02b478d8ab3ce..bb74998b71a5d 100644 --- a/src/iuse_software_snake.cpp +++ b/src/iuse_software_snake.cpp @@ -86,8 +86,8 @@ int snake_game::start_game() std::vector > vSnakeBody; std::map > mSnakeBody; - int iOffsetX = ( TERMX > FULL_SCREEN_WIDTH ) ? ( TERMX - FULL_SCREEN_WIDTH ) / 2 : 0; - int iOffsetY = ( TERMY > FULL_SCREEN_HEIGHT ) ? ( TERMY - FULL_SCREEN_HEIGHT ) / 2 : 0; + int iOffsetX = TERMX > FULL_SCREEN_WIDTH ? ( TERMX - FULL_SCREEN_WIDTH ) / 2 : 0; + int iOffsetY = TERMY > FULL_SCREEN_HEIGHT ? ( TERMY - FULL_SCREEN_HEIGHT ) / 2 : 0; catacurses::window w_snake = catacurses::newwin( FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH, iOffsetY, iOffsetX ); diff --git a/src/mutation_data.cpp b/src/mutation_data.cpp index 864afad68474f..6f9c98b64db39 100644 --- a/src/mutation_data.cpp +++ b/src/mutation_data.cpp @@ -748,7 +748,7 @@ void mutation_branch::add_entry( Trait_group &tg, JsonObject &obj ) std::shared_ptr mutation_branch::get_group( const trait_group::Trait_group_tag &gid ) { auto found = trait_groups.find( gid ); - return ( found != trait_groups.end() ) ? found->second : nullptr; + return found != trait_groups.end() ? found->second : nullptr; } std::vector mutation_branch::get_all_group_names() diff --git a/src/mutation_ui.cpp b/src/mutation_ui.cpp index f56ea5e7cc556..61deee6f1f59a 100644 --- a/src/mutation_ui.cpp +++ b/src/mutation_ui.cpp @@ -145,7 +145,7 @@ void player::power_mutations() // drawing the mutation starts with mutation[scroll_position] const int list_start_y = HEADER_LINE_Y + 2 - scroll_position; int max_scroll_position = HEADER_LINE_Y + 2 + mutations_count - - ( ( menu_mode == "examining" ) ? DESCRIPTION_LINE_Y : ( HEIGHT - 1 ) ); + ( menu_mode == "examining" ? DESCRIPTION_LINE_Y : HEIGHT - 1 ); if( redraw ) { redraw = false; @@ -175,7 +175,7 @@ void player::power_mutations() ( menu_mode == "examining" ? DESCRIPTION_LINE_Y : HEIGHT - 1 ) ) { break; } - type = ( has_base_trait( passive[i] ) ? c_cyan : c_light_cyan ); + type = has_base_trait( passive[i] ) ? c_cyan : c_light_cyan; mvwprintz( wBio, list_start_y + i, 2, type, "%c %s", td.key, md.name() ); } } @@ -191,9 +191,9 @@ void player::power_mutations() break; } if( td.powered ) { - type = ( has_base_trait( active[i] ) ? c_green : c_light_green ); + type = has_base_trait( active[i] ) ? c_green : c_light_green; } else { - type = ( has_base_trait( active[i] ) ? c_red : c_light_red ); + type = has_base_trait( active[i] ) ? c_red : c_light_red; } // TODO: track resource(s) used and specify mvwputch( wBio, list_start_y + i, second_column, type, td.key ); diff --git a/src/vehicle_display.cpp b/src/vehicle_display.cpp index 71e89b47d56c2..f135e2151267d 100644 --- a/src/vehicle_display.cpp +++ b/src/vehicle_display.cpp @@ -303,7 +303,7 @@ std::vector vehicle::get_printable_fuel_types() const { std::set opts; for( const auto &pt : parts ) { - if( ( pt.is_fuel_store() ) && pt.ammo_current() != "null" ) { + if( pt.is_fuel_store() && pt.ammo_current() != "null" ) { opts.emplace( pt.ammo_current() ); } } @@ -351,7 +351,7 @@ void vehicle::print_fuel_indicators( const catacurses::window &win, int y, int x } int yofs = 0; - int max_gauge = ( ( isHorizontal ) ? 12 : 5 ) + start_index; + int max_gauge = ( isHorizontal ? 12 : 5 ) + start_index; int max_size = std::min( static_cast( fuels.size() ), max_gauge ); std::map fuel_usages = fuel_usage(); @@ -362,7 +362,7 @@ void vehicle::print_fuel_indicators( const catacurses::window &win, int y, int x } // check if the current index is less than the max size minus 12 or 5, to indicate that there's more - if( ( start_index < static_cast( fuels.size() ) - ( ( isHorizontal ) ? 12 : 5 ) ) ) { + if( start_index < static_cast( fuels.size() ) - ( isHorizontal ? 12 : 5 ) ) { mvwprintz( win, y + yofs, x, c_light_green, ">" ); wprintz( win, c_light_gray, " for more" ); } @@ -403,7 +403,7 @@ void vehicle::print_fuel_indicator( const catacurses::window &win, int y, int x, if( debug_mode ) { mvwprintz( win, y, x + 6, f_color, "%d/%d", f_left, cap ); } else { - mvwprintz( win, y, x + 6, f_color, "%d", ( f_left * 100 ) / cap ); + mvwprintz( win, y, x + 6, f_color, "%d", f_left * 100 / cap ); wprintz( win, c_light_gray, "%c", 045 ); } } diff --git a/src/vehicle_part.cpp b/src/vehicle_part.cpp index fb84ec8470c7c..88ac5d6930ea8 100644 --- a/src/vehicle_part.cpp +++ b/src/vehicle_part.cpp @@ -95,7 +95,7 @@ std::string vehicle_part::name( bool with_prefix ) const } if( base.is_faulty() ) { - res += ( _( " (faulty)" ) ); + res += _( " (faulty)" ); } if( base.has_var( "contained_name" ) ) { @@ -113,7 +113,7 @@ int vehicle_part::hp() const { const int dur = info().durability; if( base.max_damage() > 0 ) { - return dur - ( dur * base.damage() / base.max_damage() ); + return dur - dur * base.damage() / base.max_damage(); } else { return dur; } @@ -131,7 +131,7 @@ int vehicle_part::damage_level( int max ) const double vehicle_part::health_percent() const { - return ( 1.0 - static_cast( base.damage() ) / base.max_damage() ); + return 1.0 - static_cast( base.damage() ) / base.max_damage(); } double vehicle_part::damage_percent() const diff --git a/src/weather.cpp b/src/weather.cpp index 49c2ad4fbd72b..dcc05e67ccbe7 100644 --- a/src/weather.cpp +++ b/src/weather.cpp @@ -240,7 +240,7 @@ void item::add_rain_to_container( bool acid, int charges ) // The container has water, and the acid rain didn't turn it // into weak acid. Poison the water instead, assuming 1 // charge of acid would act like a charge of water with poison 5. - int total_poison = liq.poison * ( orig ) + ( 5 * added ); + int total_poison = liq.poison * orig + 5 * added; liq.poison = total_poison / liq.charges; int leftover_poison = total_poison - liq.poison * liq.charges; if( leftover_poison > rng( 0, liq.charges ) ) { @@ -711,8 +711,8 @@ int get_local_windchill( double temperature, double humidity, double windpower ) // Temperature is removed at the end, because get_local_windchill is meant to calculate the difference. // Source : http://en.wikipedia.org/wiki/Wind_chill#North_American_and_United_Kingdom_wind_chill_index - windchill = 35.74 + 0.6215 * tmptemp - 35.75 * ( pow( tmpwind, - 0.16 ) ) + 0.4275 * tmptemp * ( pow( tmpwind, 0.16 ) ) - tmptemp; + windchill = 35.74 + 0.6215 * tmptemp - 35.75 * pow( tmpwind, + 0.16 ) + 0.4275 * tmptemp * pow( tmpwind, 0.16 ) - tmptemp; if( tmpwind < 4 ) { windchill = 0; // This model fails when there is 0 wind. } @@ -723,8 +723,8 @@ int get_local_windchill( double temperature, double humidity, double windpower ) tmpwind = tmpwind * 0.44704; // Convert to meters per second. tmptemp = temp_to_celsius( tmptemp ); - windchill = ( 0.33 * ( ( humidity / 100.00 ) * 6.105 * exp( ( 17.27 * tmptemp ) / - ( 237.70 + tmptemp ) ) ) - 0.70 * tmpwind - 4.00 ); + windchill = 0.33 * ( humidity / 100.00 * 6.105 * exp( 17.27 * tmptemp / + ( 237.70 + tmptemp ) ) ) - 0.70 * tmpwind - 4.00; // Convert to Fahrenheit, but omit the '+ 32' because we are only dealing with a piece of the felt air temperature equation. windchill = windchill * 9 / 5; } @@ -770,21 +770,21 @@ std::string get_shortdirstring( int angle ) std::string dirstring; int dirangle = angle; if( dirangle <= 23 || dirangle > 338 ) { - dirstring = ( "N" ); + dirstring = "N"; } else if( dirangle <= 68 && dirangle > 23 ) { - dirstring = ( "NE" ); + dirstring = "NE"; } else if( dirangle <= 113 && dirangle > 68 ) { - dirstring = ( "E" ); + dirstring = "E"; } else if( dirangle <= 158 && dirangle > 113 ) { - dirstring = ( "SE" ); + dirstring = "SE"; } else if( dirangle <= 203 && dirangle > 158 ) { - dirstring = ( "S" ); + dirstring = "S"; } else if( dirangle <= 248 && dirangle > 203 ) { - dirstring = ( "SW" ); + dirstring = "SW"; } else if( dirangle <= 293 && dirangle > 248 ) { - dirstring = ( "W" ); + dirstring = "W"; } else if( dirangle <= 338 && dirangle > 293 ) { - dirstring = ( "NW" ); + dirstring = "NW"; } return dirstring; } @@ -795,21 +795,21 @@ std::string get_dirstring( int angle ) std::string dirstring; int dirangle = angle; if( dirangle <= 23 || dirangle > 338 ) { - dirstring = ( "North" ); + dirstring = "North"; } else if( dirangle <= 68 && dirangle > 23 ) { - dirstring = ( "North-East" ); + dirstring = "North-East"; } else if( dirangle <= 113 && dirangle > 68 ) { - dirstring = ( "East" ); + dirstring = "East"; } else if( dirangle <= 158 && dirangle > 113 ) { - dirstring = ( "South-East" ); + dirstring = "South-East"; } else if( dirangle <= 203 && dirangle > 158 ) { - dirstring = ( "South" ); + dirstring = "South"; } else if( dirangle <= 248 && dirangle > 203 ) { - dirstring = ( "South-West" ); + dirstring = "South-West"; } else if( dirangle <= 293 && dirangle > 248 ) { - dirstring = ( "West" ); + dirstring = "West"; } else if( dirangle <= 338 && dirangle > 293 ) { - dirstring = ( "North-West" ); + dirstring = "North-West"; } return dirstring; } @@ -1028,7 +1028,7 @@ int weather_manager::get_temperature( const tripoint &location ) } //underground temperature = average New England temperature = 43F/6C rounded to int const int temp = ( location.z < 0 ? AVERAGE_ANNUAL_TEMPERATURE : temperature ) + - ( g->new_game ? 0 : ( g->m.get_temperature( location ) + temp_mod ) ); + ( g->new_game ? 0 : g->m.get_temperature( location ) + temp_mod ); temperature_cache.emplace( std::make_pair( location, temp ) ); return temp;