Skip to content

Commit

Permalink
[Refactor] hengband#1498 Replaced direct substitution to set()/reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hourier committed Sep 18, 2021
1 parent c630f9e commit ce1444e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/cmd-building/cmd-inn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ static bool has_a_nightmare(player_type *player_ptr)
*/
static void back_to_health(player_type *player_ptr)
{
auto effects = player_ptr->effects();
set_blind(player_ptr, 0);
set_confused(player_ptr, 0);
player_ptr->stun = 0;
effects->stun()->reset();
player_ptr->chp = player_ptr->mhp;
player_ptr->csp = player_ptr->msp;
}
Expand Down
14 changes: 8 additions & 6 deletions src/status/bad-status-setter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,17 @@ bool set_stun(player_type *player_ptr, TIME_EFFECT v)
notice = true;
}

player_ptr->stun = v;

if (!notice)
player_stun->set(v);
if (!notice) {
return false;
}

if (disturb_state)
if (disturb_state) {
disturb(player_ptr, false, false);
player_ptr->update |= (PU_BONUS);
player_ptr->redraw |= (PR_STUN);
}

player_ptr->update |= PU_BONUS;
player_ptr->redraw |= PR_STUN;
handle_stuff(player_ptr);
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/status/buff-setter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
void reset_tim_flags(player_type *player_ptr)
{
auto effects = player_ptr->effects();
player_ptr->fast = 0; /* Timed -- Fast */
player_ptr->lightspeed = 0;
player_ptr->slow = 0; /* Timed -- Slow */
Expand All @@ -35,7 +36,7 @@ void reset_tim_flags(player_type *player_ptr)
player_ptr->image = 0; /* Timed -- Hallucination */
player_ptr->poisoned = 0; /* Timed -- Poisoned */
player_ptr->cut = 0; /* Timed -- Cut */
player_ptr->stun = 0; /* Timed -- Stun */
effects->stun()->reset();

player_ptr->protevil = 0; /* Timed -- Protection */
player_ptr->invuln = 0; /* Timed -- Invulnerable */
Expand Down
3 changes: 1 addition & 2 deletions src/system/player-type-definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ struct player_type {
TIME_EFFECT image{}; /* Timed -- Hallucination */
TIME_EFFECT poisoned{}; /* Timed -- Poisoned */
TIME_EFFECT cut{}; /* Timed -- Cut */
TIME_EFFECT stun{}; /* Timed -- Stun */


TIME_EFFECT protevil{}; /* Timed -- Protection */
TIME_EFFECT invuln{}; /* Timed -- Invulnerable */
TIME_EFFECT ult_res{}; /* Timed -- Ultimate Resistance */
Expand Down

0 comments on commit ce1444e

Please sign in to comment.