Skip to content

Commit

Permalink
Simplify CLIMATE_CONTROL
Browse files Browse the repository at this point in the history
  • Loading branch information
actually-a-cat committed Sep 20, 2022
1 parent df589a5 commit 1b82e22
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8473,21 +8473,12 @@ int Character::bodytemp_modifier_traits_floor() const
int Character::temp_corrected_by_climate_control( int temperature ) const
{
const int variation = static_cast<int>( BODYTEMP_NORM * 0.5 );
if( temperature < BODYTEMP_SCORCHING + variation &&
temperature > BODYTEMP_FREEZING - variation ) {
if( temperature > BODYTEMP_SCORCHING ) {
temperature = BODYTEMP_VERY_HOT;
} else if( temperature > BODYTEMP_VERY_HOT ) {
temperature = BODYTEMP_HOT;
} else if( temperature < BODYTEMP_FREEZING ) {
temperature = BODYTEMP_VERY_COLD;
} else if( temperature < BODYTEMP_VERY_COLD ) {
temperature = BODYTEMP_COLD;
} else {
temperature = BODYTEMP_NORM;
}

if( temperature > BODYTEMP_NORM ) {
return std::max( BODYTEMP_NORM, temperature - variation );
} else {
return std::min( BODYTEMP_NORM, temperature + variation );
}
return temperature;
}

bool Character::in_sleep_state() const
Expand Down

0 comments on commit 1b82e22

Please sign in to comment.