Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
# Explain why this change is being made
# |<----      Limit Each Line to a Maximum Of 72 Characters       ---->|

# Provide links or keys to any relevant tickets, articles or other resources
# Example: fixes CleverRaven#1234, closes CleverRaven#2345, resolves CleverRaven#3456, references CleverRaven#4567
  • Loading branch information
redrosedialtone committed Mar 20, 2022
1 parent 43e5fb3 commit d6020c1
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/medical_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,28 +457,29 @@ static medical_column draw_health_summary( const int column_count, avatar *playe
}

for( const character_modifier &mod : character_modifier::get_all() ) {
const limb_score_id &sc = mod.use_limb_score();
if( sc.is_null() || !part->has_limb_score( sc ) ) {
continue;
}
std::string desc = mod.description().translated();
float injury_score = bp->get_limb_score( sc, 0, 0, 1 );
float max_score = part->get_limb_score( sc );
nc_color score_c;

if( injury_score < max_score * 0.4f ) {
score_c = c_red;
} else if( injury_score < max_score * 0.6f ) {
score_c = c_light_red;
} else if( injury_score < max_score * 0.75f ) {
score_c = c_yellow;
} else {
score_c = c_white;
}
for( const auto &sc : mod.use_limb_scores() ) {
if( sc.first.is_null() || !part->has_limb_score( sc.first ) ) {
continue;
}
std::string desc = mod.description().translated();
float injury_score = bp->get_limb_score( sc.first, 0, 0, 1 );
float max_score = part->get_limb_score( sc.first );
nc_color score_c;

if( injury_score < max_score * 0.4f ) {
score_c = c_red;
} else if( injury_score < max_score * 0.6f ) {
score_c = c_light_red;
} else if( injury_score < max_score * 0.75f ) {
score_c = c_yellow;
} else {
score_c = c_white;
}

std::string valstr = colorize( string_format( "%.2f", mod.modifier( *player->as_character() ) ),
score_c );
detail_str += string_format( "%s: %s%s\n", desc, mod.mod_type_str(), valstr );
std::string valstr = colorize( string_format( "%.2f", mod.modifier( *player->as_character() ) ),
score_c );
detail_str += string_format( "%s: %s%s\n", desc, mod.mod_type_str(), valstr );
}
}

line.set_detail( string_format( _( "%s STATS" ), to_upper_case( bp_name ) ), detail_str );
Expand Down

0 comments on commit d6020c1

Please sign in to comment.