Skip to content

Commit

Permalink
Removed redundant parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Jul 11, 2019
1 parent de8ff02 commit 9f1ad48
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/grab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/iuse_software_snake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ int snake_game::start_game()
std::vector<std::pair<int, int> > vSnakeBody;
std::map<int, std::map<int, bool> > 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 );
Expand Down
2 changes: 1 addition & 1 deletion src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void mutation_branch::add_entry( Trait_group &tg, JsonObject &obj )
std::shared_ptr<Trait_group> 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<trait_group::Trait_group_tag> mutation_branch::get_all_group_names()
Expand Down
8 changes: 4 additions & 4 deletions src/mutation_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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() );
}
}
Expand All @@ -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 );
Expand Down
8 changes: 4 additions & 4 deletions src/vehicle_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ std::vector<itype_id> vehicle::get_printable_fuel_types() const
{
std::set<itype_id> 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() );
}
}
Expand Down Expand Up @@ -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<int>( fuels.size() ), max_gauge );
std::map<itype_id, int> fuel_usages = fuel_usage();

Expand All @@ -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<int>( fuels.size() ) - ( ( isHorizontal ) ? 12 : 5 ) ) ) {
if( start_index < static_cast<int>( fuels.size() ) - ( isHorizontal ? 12 : 5 ) ) {
mvwprintz( win, y + yofs, x, c_light_green, ">" );
wprintz( win, c_light_gray, " for more" );
}
Expand Down Expand Up @@ -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 );
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/vehicle_part.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) ) {
Expand All @@ -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;
}
Expand All @@ -131,7 +131,7 @@ int vehicle_part::damage_level( int max ) const

double vehicle_part::health_percent() const
{
return ( 1.0 - static_cast<double>( base.damage() ) / base.max_damage() );
return 1.0 - static_cast<double>( base.damage() ) / base.max_damage();
}

double vehicle_part::damage_percent() const
Expand Down
44 changes: 22 additions & 22 deletions src/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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.
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9f1ad48

Please sign in to comment.