Skip to content

Commit

Permalink
Merge pull request #35 from zpmorgan/foo
Browse files Browse the repository at this point in the history
reset_light_level() for immediate lighting changes
  • Loading branch information
TheDarklingWolf committed Feb 2, 2013
2 parents ec0dc23 + c5743b6 commit 81bf947
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions artifact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ void game::process_artifact(item *it, player *p, bool wielded)
p->int_cur -= 2;
break;

case AEP_GLOW:
reset_light_level();
break;

case AEP_SPEED_DOWN:
break; // Handled in player::current_speed()
}
Expand Down
4 changes: 4 additions & 0 deletions bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ void player::activate_bionic(int b, game *g)
add_disease(DI_TELEGLOW, rng(50, 400), g);
break;

case bio_flashlight:
g->reset_light_level();
break;

case bio_teleport:
g->teleport();
add_disease(DI_TELEGLOW, 300, g);
Expand Down
6 changes: 6 additions & 0 deletions game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,12 @@ unsigned char game::light_level()
return ret;
}

void game::reset_light_level()
{
latest_lightlevel = 0;
latest_lightlevel_turn = 0;
}

int game::assign_npc_id()
{
int ret = next_npc_id;
Expand Down
1 change: 1 addition & 0 deletions game.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class game
int& scent(int x, int y);
float natural_light_level();
unsigned char light_level();
void reset_light_level();
int assign_npc_id();
int assign_faction_id();
faction* faction_by_id(int it);
Expand Down
7 changes: 7 additions & 0 deletions iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ void iuse::light_off(game *g, player *p, item *it, bool t)
it->make(g->itypes[itm_flashlight_on]);
it->active = true;
it->charges --;
g->reset_light_level();
}
}

Expand All @@ -981,6 +982,7 @@ void iuse::light_on(game *g, player *p, item *it, bool t)
g->add_msg_if_player(p,"The flashlight flicks off.");
it->make(g->itypes[itm_flashlight]);
it->active = false;
g->reset_light_level();
}
}

Expand Down Expand Up @@ -2529,6 +2531,7 @@ else {
g->add_msg_if_player(p,"You light the torch.");
it->make(g->itypes[itm_torch_lit]);
it->active = true;
g->reset_light_level();
}
}

Expand All @@ -2541,6 +2544,7 @@ void iuse::torch_lit(game *g, player *p, item *it, bool t)
it->charges -= 1;
it->make(g->itypes[itm_torch]);
it->active = false;
g->reset_light_level();
}
}

Expand All @@ -2554,6 +2558,7 @@ else {
g->add_msg_if_player(p,"You light the candle.");
it->make(g->itypes[itm_candle_lit]);
it->active = true;
g->reset_light_level();
}
}

Expand All @@ -2565,6 +2570,7 @@ void iuse::candle_lit(game *g, player *p, item *it, bool t)
g->add_msg_if_player(p,"The candle winks out");
it->make(g->itypes[itm_candle]);
it->active = false;
g->reset_light_level();
}
}

Expand Down Expand Up @@ -3126,6 +3132,7 @@ void iuse::artifact(game *g, player *p, item *it, bool t)
case AEA_LIGHT:
g->add_msg_if_player(p,"The %s glows brightly!", it->tname().c_str());
g->add_event(EVENT_ARTIFACT_LIGHT, int(g->turn) + 30);
g->reset_light_level();
break;

case AEA_GROWTH: {
Expand Down

0 comments on commit 81bf947

Please sign in to comment.