• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision1c59ce688b17df63953521827d0540c2a17dd1b4 (tree)
Time2019-06-27 11:40:42
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/cmd-item.c
+++ b/src/cmd-item.c
@@ -449,7 +449,7 @@ void do_cmd_wield(void)
449449 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
450450 {
451451 /* Turn into a vampire */
452- change_race(RACE_VAMPIRE, "");
452+ change_race(p_ptr, RACE_VAMPIRE, "");
453453 }
454454
455455 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -3707,10 +3707,10 @@ void do_poly_wounds(void)
37073707 /*
37083708 * Change player race
37093709 */
3710-void change_race(CHARACTER_IDX new_race, concptr effect_msg)
3710+void change_race(player_type *creature_ptr, CHARACTER_IDX new_race, concptr effect_msg)
37113711 {
37123712 concptr title = race_info[new_race].title;
3713- int old_race = p_ptr->prace;
3713+ int old_race = creature_ptr->prace;
37143714
37153715 #ifdef JP
37163716 msg_format("あなたは%s%sに変化した!", effect_msg, title);
@@ -3720,52 +3720,52 @@ void change_race(CHARACTER_IDX new_race, concptr effect_msg)
37203720
37213721 chg_virtue(V_CHANCE, 2);
37223722
3723- if (p_ptr->prace < 32)
3723+ if (creature_ptr->prace < 32)
37243724 {
3725- p_ptr->old_race1 |= 1L << p_ptr->prace;
3725+ creature_ptr->old_race1 |= 1L << creature_ptr->prace;
37263726 }
37273727 else
37283728 {
3729- p_ptr->old_race2 |= 1L << (p_ptr->prace - 32);
3729+ creature_ptr->old_race2 |= 1L << (creature_ptr->prace - 32);
37303730 }
3731- p_ptr->prace = new_race;
3732- rp_ptr = &race_info[p_ptr->prace];
3731+ creature_ptr->prace = new_race;
3732+ rp_ptr = &race_info[creature_ptr->prace];
37333733
37343734 /* Experience factor */
3735- p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
3735+ creature_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
37363736
37373737 /*
37383738 * The speed bonus of Klackons and Sprites are disabled
37393739 * and the experience penalty is decreased.
37403740 */
3741- if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && ((p_ptr->prace == RACE_KLACKON) || (p_ptr->prace == RACE_SPRITE)))
3742- p_ptr->expfact -= 15;
3741+ if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_NINJA)) && ((creature_ptr->prace == RACE_KLACKON) || (creature_ptr->prace == RACE_SPRITE)))
3742+ creature_ptr->expfact -= 15;
37433743
37443744 /* Get character's height and weight */
37453745 get_height_weight();
37463746
37473747 /* Hitdice */
3748- if (p_ptr->pclass == CLASS_SORCERER)
3749- p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
3748+ if (creature_ptr->pclass == CLASS_SORCERER)
3749+ creature_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
37503750 else
3751- p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
3751+ creature_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
37523752
3753- roll_hitdice(p_ptr, 0L);
3753+ roll_hitdice(creature_ptr, 0L);
37543754
37553755 /* The experience level may be modified */
37563756 check_experience();
37573757
3758- p_ptr->redraw |= (PR_BASIC);
3758+ creature_ptr->redraw |= (PR_BASIC);
37593759
3760- p_ptr->update |= (PU_BONUS);
3760+ creature_ptr->update |= (PU_BONUS);
37613761
37623762 handle_stuff();
37633763
37643764 /* Load an autopick preference file */
3765- if (old_race != p_ptr->prace) autopick_load_pref(FALSE);
3765+ if (old_race != creature_ptr->prace) autopick_load_pref(FALSE);
37663766
37673767 /* Player's graphic tile may change */
3768- lite_spot(p_ptr->y, p_ptr->x);
3768+ lite_spot(creature_ptr->y, creature_ptr->x);
37693769 }
37703770
37713771
@@ -3850,7 +3850,7 @@ void do_poly_self(player_type *creature_ptr)
38503850 }
38513851 while ((new_race == creature_ptr->prace) || (new_race == RACE_ANDROID));
38523852
3853- change_race(new_race, effect_msg);
3853+ change_race(p_ptr, new_race, effect_msg);
38543854 }
38553855
38563856 if ((power > randint0(30)) && one_in_(6))
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -81,7 +81,7 @@ extern bool set_wraith_form(TIME_EFFECT v, bool do_dec);
8181 extern bool set_tim_esp(TIME_EFFECT v, bool do_dec);
8282 extern bool set_superstealth(bool set);
8383 extern void do_poly_wounds(void);
84-extern void change_race(CHARACTER_IDX new_race, concptr effect_msg);
84+extern void change_race(player_type *creature_ptr, CHARACTER_IDX new_race, concptr effect_msg);
8585
8686 extern const kamae kamae_shurui[MAX_KAMAE];
8787 extern const kamae kata_shurui[MAX_KATA];
Show on old repository browser