diff --git a/src/game_constants.h b/src/game_constants.h index ce0470a0b407..01571b5e3aba 100644 --- a/src/game_constants.h +++ b/src/game_constants.h @@ -76,6 +76,10 @@ static constexpr int VEHICLE_HANDLING_PENALTY = 80; static constexpr int PLUTONIUM_CHARGES = 500; // Temperature constants. + +/// Average annual temperature used for climate, weather and temperature calculation. +constexpr units::temperature average_annual_termperature = 6_c; + namespace temperatures { // temperature at which something starts is considered HOT. @@ -97,8 +101,7 @@ constexpr units::temperature freezer = -5_c; constexpr units::temperature freezing = 0_c; // Arbitrary constant for root cellar temperature -// Should be equal to AVERAGE_ANNUAL_TEMPERATURE, but is declared before it... -constexpr units::temperature root_cellar = 6_c; +constexpr units::temperature root_cellar = average_annual_termperature; } // namespace temperatures // Weight per level of LIFT/JACK tool quality. @@ -139,12 +142,6 @@ static constexpr int BIO_CQB_LEVEL = 5; // Minimum size of a horde to show up on the minimap. static constexpr int HORDE_VISIBILITY_SIZE = 3; -/** - * Average annual temperature in F used for climate, weather and temperature calculation. - * Average New England temperature = 43F/6C rounded to int. -*/ -static constexpr int AVERAGE_ANNUAL_TEMPERATURE = 43; - /** * Base starting spring temperature in F used for climate, weather and temperature calculation. * New England base spring temperature = 65F/18C rounded to int. diff --git a/src/item.cpp b/src/item.cpp index 195e403723e1..698ae928c6b1 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -9018,7 +9018,7 @@ bool item::process_rot( const bool seals, const tripoint &pos, calendar::config, seed ); env_temperature_raw = weather_temperature + local_mod; } else { - env_temperature_raw = units::from_fahrenheit( AVERAGE_ANNUAL_TEMPERATURE ) + local_mod; + env_temperature_raw = average_annual_termperature + local_mod; } units::temperature env_temperature_clipped = clip_by_temperature_flag( env_temperature_raw, flag ); diff --git a/src/weather.cpp b/src/weather.cpp index b806b47d4a33..8bfb150e8463 100644 --- a/src/weather.cpp +++ b/src/weather.cpp @@ -1119,7 +1119,8 @@ int weather_manager::get_temperature( const tripoint &location ) const temp_mod += get_convection_temperature( location ); } //underground temperature = average New England temperature = 43F/6C rounded to int - const int temp = ( location.z < 0 ? AVERAGE_ANNUAL_TEMPERATURE : temperature ) + + const int temp = ( location.z < 0 ? units::to_fahrenheit( average_annual_termperature ) : + temperature ) + ( g->new_game ? 0 : g->m.get_temperature( location ) + temp_mod ); temperature_cache.emplace( std::make_pair( location, temp ) ); @@ -1129,7 +1130,7 @@ int weather_manager::get_temperature( const tripoint &location ) const int weather_manager::get_temperature( const tripoint_abs_omt &location ) { if( location.z() < 0 ) { - return AVERAGE_ANNUAL_TEMPERATURE; + return units::to_fahrenheit( average_annual_termperature ); } tripoint abs_ms = project_to( location ).raw();