Skip to content

Commit d1be24f

Browse files
authored
Rename a get_temperature function and add some header comments (#82937)
1 parent 5ac2b2c commit d1be24f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/map.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8381,7 +8381,8 @@ void map::handle_decayed_corpse( const item &it, const tripoint_abs_ms &pnt )
83818381
anything_left = roll > 0;
83828382
for( int i = 0; i < roll; i++ ) {
83838383
if( harvest.has_temperature() ) {
8384-
harvest.set_item_temperature( get_weather().get_temperature( project_to<coords::omt>( pnt ) ) );
8384+
harvest.set_item_temperature( get_weather().get_area_temperature( project_to<coords::omt>
8385+
( pnt ) ) );
83858386
}
83868387
add_item_or_charges( get_bub( pnt ), harvest, false );
83878388
if( anything_left && notify_player ) {

src/weather.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ bool warm_enough_to_plant( const tripoint_abs_omt &pos, const itype_id &it )
883883
std::map<time_point, units::temperature> planting_times;
884884
// initialize the first...
885885
time_point check_date = calendar::turn;
886-
planting_times[check_date] = get_weather().get_temperature( pos );
886+
planting_times[check_date] = get_weather().get_area_temperature( pos );
887887
bool okay_to_plant = true;
888888
const int num_epochs = 3; // FIXME. Should be stored on the seed ptr and read from there!
889889
// and now iterate a copy of the weather into the future to see if they'll be plantable then as well.
@@ -1011,7 +1011,7 @@ units::temperature weather_manager::get_temperature( const tripoint_bub_ms &loca
10111011
return temp;
10121012
}
10131013

1014-
units::temperature weather_manager::get_temperature( const tripoint_abs_omt &location ) const
1014+
units::temperature weather_manager::get_area_temperature( const tripoint_abs_omt &location ) const
10151015
{
10161016
return location.z() < 0 ? units::from_celsius(
10171017
get_weather().get_cur_weather_gen().base_temperature ) : temperature;

src/weather.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,16 @@ class weather_manager
220220
time_point nextweather;
221221
/** temperature cache, cleared every turn, sparse map of map tripoints to temperatures */
222222
std::unordered_map< tripoint_bub_ms, units::temperature > temperature_cache;
223-
// Returns outdoor or indoor temperature of given location
223+
/*
224+
* Returns current temperature of given tile. Includes temperature modifications from
225+
* radiative and convective sources, such as fires or hot air from heaters.
226+
*/
224227
units::temperature get_temperature( const tripoint_bub_ms &location );
225-
// Returns outdoor or indoor temperature of given location
226-
units::temperature get_temperature( const tripoint_abs_omt &location ) const;
228+
/*
229+
* Returns temperature of given OMT. Does not include any modifications from local sourecs,
230+
* this is essentially the "natural" temperature.
231+
*/
232+
units::temperature get_area_temperature( const tripoint_abs_omt &location ) const;
227233
void clear_temp_cache();
228234
static void serialize_all( JsonOut &json );
229235
static void unserialize_all( const JsonObject &w );

0 commit comments

Comments
 (0)