OSDN Git Service

[Refactor] #38997 calc_android_exp() に player_type * 引数を追加.
[hengband/hengband.git] / src / player-effects.c
index 3bca880..e399170 100644 (file)
@@ -3570,15 +3570,15 @@ bool do_res_stat(player_type *creature_ptr, int stat)
 /*
  * Gain a "point" in a stat
  */
-bool do_inc_stat(int stat)
+bool do_inc_stat(player_type *creature_ptr, int stat)
 {
        bool res;
 
        /* Restore strength */
-       res = res_stat(p_ptr, stat);
+       res = res_stat(creature_ptr, stat);
 
        /* Attempt to increase */
-       if (inc_stat(p_ptr, stat))
+       if (inc_stat(creature_ptr, stat))
        {
                if (stat == A_WIS)
                {
@@ -3614,15 +3614,15 @@ bool do_inc_stat(int stat)
 /*
  * Restores any drained experience
  */
-bool restore_level(void)
+bool restore_level(player_type *creature_ptr)
 {
        /* Restore experience */
-       if (p_ptr->exp < p_ptr->max_exp)
+       if (creature_ptr->exp < creature_ptr->max_exp)
        {
                msg_print(_("経験値が戻ってきた気がする。", "You feel your experience returning."));
 
                /* Restore the experience */
-               p_ptr->exp = p_ptr->max_exp;
+               creature_ptr->exp = creature_ptr->max_exp;
 
                /* Check the experience */
                check_experience();
@@ -3638,7 +3638,7 @@ bool restore_level(void)
 /*
  * Forget everything
  */
-bool lose_all_info(void)
+bool lose_all_info(player_type *creature_ptr)
 {
        int i;
 
@@ -3648,7 +3648,7 @@ bool lose_all_info(void)
        /* Forget info about objects */
        for (i = 0; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Allow "protection" by the MENTAL flag */
@@ -3666,10 +3666,10 @@ bool lose_all_info(void)
                /* Hack -- Clear the "felt" flag */
                o_ptr->ident &= ~(IDENT_SENSE);
        }
-       p_ptr->update |= (PU_BONUS);
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
+       creature_ptr->update |= (PU_BONUS);
+       creature_ptr->update |= (PU_COMBINE | PU_REORDER);
 
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        /* Mega-Hack -- Forget the map */
        wiz_dark();
@@ -3936,17 +3936,17 @@ void gain_exp(s32b amount)
 }
 
 
-void calc_android_exp(void)
+void calc_android_exp(player_type *creature_ptr)
 {
        int i;
        u32b total_exp = 0;
-       if (p_ptr->is_dead) return;
+       if (creature_ptr->is_dead) return;
 
-       if (p_ptr->prace != RACE_ANDROID) return;
+       if (creature_ptr->prace != RACE_ANDROID) return;
 
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
                object_type forge;
                object_type *q_ptr = &forge;
                u32b value, exp;
@@ -3995,7 +3995,7 @@ void calc_android_exp(void)
                value = object_value_real(q_ptr);
 
                if (value <= 0) continue;
-               if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (p_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
+               if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI) && (creature_ptr->pseikaku != SEIKAKU_SEXY)) value /= 32;
                if (value > 5000000L) value = 5000000L;
                if ((o_ptr->tval == TV_DRAG_ARMOR) || (o_ptr->tval == TV_CARD)) level /= 2;
 
@@ -4024,7 +4024,7 @@ void calc_android_exp(void)
                else total_exp += exp / 16;
                if (i == INVEN_BODY) total_exp += exp / 32;
        }
-       p_ptr->exp = p_ptr->max_exp = total_exp;
+       creature_ptr->exp = creature_ptr->max_exp = total_exp;
 
        /* Check Experience */
        check_experience();