• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision3b3632a5bd2408e59268422e059e3e00973b99eb (tree)
Time2019-06-20 23:37:06
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 inc_stat(), do_res_stat() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/cmd-eat.c
+++ b/src/cmd-eat.c
@@ -218,13 +218,13 @@ void exe_eat_food(INVENTORY_IDX item)
218218
219219 case SV_FOOD_RESTORE_STR:
220220 {
221- if (do_res_stat(A_STR)) ident = TRUE;
221+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
222222 break;
223223 }
224224
225225 case SV_FOOD_RESTORE_CON:
226226 {
227- if (do_res_stat(A_CON)) ident = TRUE;
227+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
228228 break;
229229 }
230230
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -345,27 +345,27 @@ void exe_quaff_potion(INVENTORY_IDX item)
345345 break;
346346
347347 case SV_POTION_RES_STR:
348- if (do_res_stat(A_STR)) ident = TRUE;
348+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
349349 break;
350350
351351 case SV_POTION_RES_INT:
352- if (do_res_stat(A_INT)) ident = TRUE;
352+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
353353 break;
354354
355355 case SV_POTION_RES_WIS:
356- if (do_res_stat(A_WIS)) ident = TRUE;
356+ if (do_res_stat(p_ptr, A_WIS)) ident = TRUE;
357357 break;
358358
359359 case SV_POTION_RES_DEX:
360- if (do_res_stat(A_DEX)) ident = TRUE;
360+ if (do_res_stat(p_ptr, A_DEX)) ident = TRUE;
361361 break;
362362
363363 case SV_POTION_RES_CON:
364- if (do_res_stat(A_CON)) ident = TRUE;
364+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
365365 break;
366366
367367 case SV_POTION_RES_CHR:
368- if (do_res_stat(A_CHR)) ident = TRUE;
368+ if (do_res_stat(p_ptr, A_CHR)) ident = TRUE;
369369 break;
370370
371371 case SV_POTION_INC_STR:
--- a/src/cmd-usestaff.c
+++ b/src/cmd-usestaff.c
@@ -177,7 +177,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
177177
178178 case SV_STAFF_THE_MAGI:
179179 {
180- if (do_res_stat(A_INT)) ident = TRUE;
180+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
181181 ident |= restore_mana(FALSE);
182182 if (set_shero(0, TRUE)) ident = TRUE;
183183 break;
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -3213,15 +3213,15 @@ bool set_food(TIME_EFFECT v)
32133213 * Note that this function (used by stat potions) now restores\n
32143214 * the stat BEFORE increasing it.\n
32153215 */
3216-bool inc_stat(int stat)
3216+bool inc_stat(player_type *creature_ptr, int stat)
32173217 {
32183218 BASE_STATUS value, gain;
32193219
32203220 /* Then augment the current/max stat */
3221- value = p_ptr->stat_cur[stat];
3221+ value = creature_ptr->stat_cur[stat];
32223222
32233223 /* Cannot go above 18/100 */
3224- if (value < p_ptr->stat_max_max[stat])
3224+ if (value < creature_ptr->stat_max_max[stat])
32253225 {
32263226 /* Gain one (sometimes two) points */
32273227 if (value < 18)
@@ -3231,17 +3231,17 @@ bool inc_stat(int stat)
32313231 }
32323232
32333233 /* Gain 1/6 to 1/3 of distance to 18/100 */
3234- else if (value < (p_ptr->stat_max_max[stat]-2))
3234+ else if (value < (creature_ptr->stat_max_max[stat]-2))
32353235 {
32363236 /* Approximate gain value */
3237- gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
3237+ gain = (((creature_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
32383238 if (gain < 1) gain = 1;
32393239
32403240 /* Apply the bonus */
32413241 value += randint1(gain) + gain / 2;
32423242
32433243 /* Maximal value */
3244- if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
3244+ if (value > (creature_ptr->stat_max_max[stat]-1)) value = creature_ptr->stat_max_max[stat]-1;
32453245 }
32463246
32473247 /* Gain one point at a time */
@@ -3251,14 +3251,14 @@ bool inc_stat(int stat)
32513251 }
32523252
32533253 /* Save the new value */
3254- p_ptr->stat_cur[stat] = value;
3254+ creature_ptr->stat_cur[stat] = value;
32553255
32563256 /* Bring up the maximum too */
3257- if (value > p_ptr->stat_max[stat])
3257+ if (value > creature_ptr->stat_max[stat])
32583258 {
3259- p_ptr->stat_max[stat] = value;
3259+ creature_ptr->stat_max[stat] = value;
32603260 }
3261- p_ptr->update |= (PU_BONUS);
3261+ creature_ptr->update |= (PU_BONUS);
32623262
32633263 /* Success */
32643264 return (TRUE);
@@ -3554,13 +3554,12 @@ bool do_dec_stat(player_type *creature_ptr, int stat)
35543554 /*
35553555 * Restore lost "points" in a stat
35563556 */
3557-bool do_res_stat(int stat)
3557+bool do_res_stat(player_type *creature_ptr, int stat)
35583558 {
35593559 /* Attempt to increase */
3560- if (res_stat(p_ptr, stat))
3560+ if (res_stat(creature_ptr, stat))
35613561 {
35623562 msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
3563-
35643563 return (TRUE);
35653564 }
35663565
@@ -3580,7 +3579,7 @@ bool do_inc_stat(int stat)
35803579 res = res_stat(p_ptr, stat);
35813580
35823581 /* Attempt to increase */
3583- if (inc_stat(stat))
3582+ if (inc_stat(p_ptr, stat))
35843583 {
35853584 if (stat == A_WIS)
35863585 {
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -57,12 +57,12 @@ extern bool set_oppose_pois(TIME_EFFECT v, bool do_dec);
5757 extern bool set_stun(TIME_EFFECT v);
5858 extern bool set_cut(TIME_EFFECT v);
5959 extern bool set_food(TIME_EFFECT v);
60-extern bool inc_stat(int stat);
60+extern bool inc_stat(player_type *creature_ptr, int stat);
6161 extern bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
6262 extern bool res_stat(player_type *creature_ptr, int stat);
6363 extern bool hp_player(int num);
6464 extern bool do_dec_stat(player_type *creature_ptr, int stat);
65-extern bool do_res_stat(int stat);
65+extern bool do_res_stat(player_type *creature_ptr, int stat);
6666 extern bool do_inc_stat(int stat);
6767 extern bool restore_level(void);
6868 extern bool lose_all_info(void);
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -395,12 +395,12 @@ bool_hack restore_mana(bool_hack magic_eater)
395395 bool restore_all_status(void)
396396 {
397397 bool ident = FALSE;
398- if (do_res_stat(A_STR)) ident = TRUE;
399- if (do_res_stat(A_INT)) ident = TRUE;
400- if (do_res_stat(A_WIS)) ident = TRUE;
401- if (do_res_stat(A_DEX)) ident = TRUE;
402- if (do_res_stat(A_CON)) ident = TRUE;
403- if (do_res_stat(A_CHR)) ident = TRUE;
398+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
399+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
400+ if (do_res_stat(p_ptr, A_WIS)) ident = TRUE;
401+ if (do_res_stat(p_ptr, A_DEX)) ident = TRUE;
402+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
403+ if (do_res_stat(p_ptr, A_CHR)) ident = TRUE;
404404 return ident;
405405 }
406406
Show on old repository browser