Skip to content

Commit

Permalink
Don't generate fire armor info if unecessary
Browse files Browse the repository at this point in the history
The vast majority of the time, we won't have any blisters - so only go
through the mildly expensive process of getting fire armor when we have
blisters.
  • Loading branch information
anothersimulacrum committed Aug 13, 2021
1 parent 04aa599 commit 7f17f94
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6811,7 +6811,9 @@ void Character::update_bodytemp()
std::map<bodypart_id, int> warmth_per_bp = warmth( clothing_map );
std::map<bodypart_id, int> bonus_warmth_per_bp = bonus_item_warmth( clothing_map );
std::map<bodypart_id, int> wind_res_per_bp = get_wind_resistance( clothing_map );
std::map<bodypart_id, int> fire_armor_per_bp = get_armor_fire( clothing_map );
// We might not use this at all, so leave it empty
// If we do need to use it, we'll initialize it (once) there
std::map<bodypart_id, int> fire_armor_per_bp;
// Current temperature and converging temperature calculations
for( const bodypart_id &bp : get_all_body_parts() ) {

Expand Down Expand Up @@ -6881,7 +6883,13 @@ void Character::update_bodytemp()
// BLISTERS : Skin gets blisters from intense heat exposure.
// Fire protection protects from blisters.
// Heatsinks give near-immunity.
if( blister_count - fire_armor_per_bp[bp] - ( has_heatsink ? 20 : 0 ) > 0 ) {
if( has_heatsink ) {
blister_count -= 20;
}
if( fire_armor_per_bp.empty() && blister_count > 0 ) {
fire_armor_per_bp = get_armor_fire( clothing_map );
}
if( blister_count - fire_armor_per_bp[bp] > 0 ) {
add_effect( effect_blisters, 1_turns, bp );
if( pyromania ) {
add_morale( MORALE_PYROMANIA_NEARFIRE, 10, 10, 1_hours,
Expand Down

0 comments on commit 7f17f94

Please sign in to comment.