Skip to content

Commit

Permalink
Made appropriate changes to use get_temperature() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoes01 committed Aug 24, 2013
1 parent 22fb79a commit e1e17dd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
15 changes: 8 additions & 7 deletions game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3840,19 +3840,20 @@ void game::draw()
}

nc_color col_temp = c_blue;
if (temperature >= 90) {
int display_temp = get_temperature(u.posx, u.posy);
if (display_temp >= 90) {
col_temp = c_red;
} else if (temperature >= 75) {
} else if (display_temp >= 75) {
col_temp = c_yellow;
} else if (temperature >= 60) {
} else if (display_temp >= 60) {
col_temp = c_ltgreen;
} else if (temperature >= 50) {
} else if (display_temp >= 50) {
col_temp = c_cyan;
} else if (temperature > 32) {
} else if (display_temp > 32) {
col_temp = c_ltblue;
}

wprintz(w_location, col_temp, (std::string(" ") + print_temperature(temperature)).c_str());
wprintz(w_location, col_temp, (std::string(" ") + print_temperature(display_temp)).c_str());
wrefresh(w_location);

//Safemode coloring
Expand Down Expand Up @@ -10779,7 +10780,7 @@ void game::plswim(int x, int y)

int drenchFlags = mfb(bp_legs)|mfb(bp_torso)|mfb(bp_arms);

if (temperature < 50)
if (get_temperature(u.posx, u.posy) < 50)
drenchFlags |= mfb(bp_feet)|mfb(bp_hands);

if (u.underwater)
Expand Down
2 changes: 1 addition & 1 deletion iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ void iexamine::flower_poppy(game *g, player *p, map *m, int examx, int examy) {
}

void iexamine::dirtmound(game *g, player *p, map *m, int examx, int examy) {
if (g->temperature < 50) // semi-appropriate temperature for most plants
if (g->get_temperature(u.posx, u.posy) < 50) // semi-appropriate temperature for most plants
g->add_msg(_("It is too cold to plant anything now."));

const bool lightCheck = true; // TODO: This.
Expand Down
6 changes: 3 additions & 3 deletions player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void player::update_bodytemp(game *g)
{
// NOTE : visit weather.h for some details on the numbers used
// Converts temperature to Celsius/10(Wito plans on using degrees Kelvin later)
int Ctemperature = 100*(g->temperature - 32) * 5/9;
int Ctemperature = 100*(g->get_temperature(u.posx, u.posy) - 32) * 5/9;
// Temperature norms
// Ambient normal temperature is lower while asleep
int ambient_norm = (has_disease("sleep") ? 3100 : 1900);
Expand Down Expand Up @@ -977,7 +977,7 @@ void player::update_bodytemp(game *g)
{
frostbite_timer[i]--;
}
if (frostbite_timer[i] >= 240 && g->temperature < 32)
if (frostbite_timer[i] >= 240 && g->get_temperature(u.posx, u.posy) < 32)
{
add_disease(dis_type(frost_pen), 1, 2, 2);
// Warning message for the player
Expand All @@ -986,7 +986,7 @@ void player::update_bodytemp(game *g)
{
g->add_msg((i == bp_mouth ? _("Your %s hardens from the frostbite!") : _("Your %s harden from the frostbite!")), body_part_name(body_part(i), -1).c_str());
}
else if (frostbite_timer[i] >= 120 && g->temperature < 32)
else if (frostbite_timer[i] >= 120 && g->get_temperature(u.posx, u.posy) < 32)
{
add_disease(dis_type(frost_pen), 1, 1, 2);
// Warning message for the player
Expand Down
2 changes: 1 addition & 1 deletion tests/player_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C" {
// core body temperature settles.
void temperature_check( game *g, player *p, int ambient_temp, int target_temp, std::string clothing )
{
g->temperature = ambient_temp;
g->get_temperature(u.posx, u.posy) = ambient_temp;
for (int i = 0 ; i < num_bp; i++)
{
p->temp_cur[i] = BODYTEMP_NORM;
Expand Down

0 comments on commit e1e17dd

Please sign in to comment.