OSDN Git Service

[Refactor] #38997 gain_exp_64() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Fri, 28 Jun 2019 17:08:58 +0000 (02:08 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 28 Jun 2019 17:08:58 +0000 (02:08 +0900)
src/monster-status.c
src/player-effects.c
src/player-effects.h

index 2a5c76f..8a5a878 100644 (file)
@@ -176,7 +176,7 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr)
        s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
 
        /* Gain experience */
-       gain_exp_64(new_exp, new_exp_frac);
+       gain_exp_64(p_ptr, new_exp, new_exp_frac);
 }
 
 
index 79e42c5..c75e013 100644 (file)
@@ -3906,20 +3906,20 @@ void do_poly_self(player_type *creature_ptr)
 /*
  * Gain experience
  */
-void gain_exp_64(s32b amount, u32b amount_frac)
+void gain_exp_64(player_type *creature_ptr, s32b amount, u32b amount_frac)
 {
-       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;
 
        /* Gain some experience */
-       s64b_add(&(p_ptr->exp), &(p_ptr->exp_frac), amount, amount_frac);
+       s64b_add(&(creature_ptr->exp), &(creature_ptr->exp_frac), amount, amount_frac);
 
        /* Slowly recover from experience drainage */
-       if (p_ptr->exp < p_ptr->max_exp)
+       if (creature_ptr->exp < creature_ptr->max_exp)
        {
                /* Gain max experience (20%) (was 10%) */
-               p_ptr->max_exp += amount / 5;
+               creature_ptr->max_exp += amount / 5;
        }
 
        /* Check Experience */
@@ -3932,7 +3932,7 @@ void gain_exp_64(s32b amount, u32b amount_frac)
  */
 void gain_exp(player_type *creature_ptr, s32b amount)
 {
-       gain_exp_64(amount, 0L);
+       gain_exp_64(creature_ptr, amount, 0L);
 }
 
 
index a58cb33..d4a3b95 100644 (file)
@@ -66,7 +66,7 @@ extern bool do_res_stat(player_type *creature_ptr, int stat);
 extern bool do_inc_stat(player_type *creature_ptr, int stat);
 extern bool restore_level(player_type *creature_ptr);
 extern bool lose_all_info(player_type *creature_ptr);
-extern void gain_exp_64(s32b amount, u32b amount_frac);
+extern void gain_exp_64(player_type *creature_ptr, s32b amount, u32b amount_frac);
 extern void gain_exp(player_type *creature_ptr, s32b amount);
 extern void calc_android_exp(player_type *creature_ptr);
 extern void lose_exp(player_type *creature_ptr, s32b amount);