Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8381,7 +8381,8 @@ void map::handle_decayed_corpse( const item &it, const tripoint_abs_ms &pnt )
anything_left = roll > 0;
for( int i = 0; i < roll; i++ ) {
if( harvest.has_temperature() ) {
harvest.set_item_temperature( get_weather().get_temperature( project_to<coords::omt>( pnt ) ) );
harvest.set_item_temperature( get_weather().get_area_temperature( project_to<coords::omt>
( pnt ) ) );
}
add_item_or_charges( get_bub( pnt ), harvest, false );
if( anything_left && notify_player ) {
Expand Down
4 changes: 2 additions & 2 deletions src/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ bool warm_enough_to_plant( const tripoint_abs_omt &pos, const itype_id &it )
std::map<time_point, units::temperature> planting_times;
// initialize the first...
time_point check_date = calendar::turn;
planting_times[check_date] = get_weather().get_temperature( pos );
planting_times[check_date] = get_weather().get_area_temperature( pos );
bool okay_to_plant = true;
const int num_epochs = 3; // FIXME. Should be stored on the seed ptr and read from there!
// and now iterate a copy of the weather into the future to see if they'll be plantable then as well.
Expand Down Expand Up @@ -1011,7 +1011,7 @@ units::temperature weather_manager::get_temperature( const tripoint_bub_ms &loca
return temp;
}

units::temperature weather_manager::get_temperature( const tripoint_abs_omt &location ) const
units::temperature weather_manager::get_area_temperature( const tripoint_abs_omt &location ) const
{
return location.z() < 0 ? units::from_celsius(
get_weather().get_cur_weather_gen().base_temperature ) : temperature;
Expand Down
12 changes: 9 additions & 3 deletions src/weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,16 @@ class weather_manager
time_point nextweather;
/** temperature cache, cleared every turn, sparse map of map tripoints to temperatures */
std::unordered_map< tripoint_bub_ms, units::temperature > temperature_cache;
// Returns outdoor or indoor temperature of given location
/*
* Returns current temperature of given tile. Includes temperature modifications from
* radiative and convective sources, such as fires or hot air from heaters.
*/
units::temperature get_temperature( const tripoint_bub_ms &location );
// Returns outdoor or indoor temperature of given location
units::temperature get_temperature( const tripoint_abs_omt &location ) const;
/*
* Returns temperature of given OMT. Does not include any modifications from local sourecs,
* this is essentially the "natural" temperature.
*/
units::temperature get_area_temperature( const tripoint_abs_omt &location ) const;
void clear_temp_cache();
static void serialize_all( JsonOut &json );
static void unserialize_all( const JsonObject &w );
Expand Down
Loading