From 1bcfabd156db910f63d547818075799c1deb0c46 Mon Sep 17 00:00:00 2001 From: deskull Date: Fri, 5 Jul 2019 23:12:18 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20player=5Foutfit()=20?= =?utf8?q?=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=EF=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/birth.c | 52 ++++++++++++++++++++++++++-------------------------- src/birth.h | 2 +- src/core.c | 2 +- src/wizard2.c | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/birth.c b/src/birth.c index f479f6033..983b74c58 100644 --- a/src/birth.c +++ b/src/birth.c @@ -2234,7 +2234,7 @@ static void add_outfit(object_type *o_ptr) * @details Having an item makes the player "aware" of its purpose. * @return なし */ -void player_outfit(void) +void player_outfit(player_type *creature_ptr) { int i; OBJECT_TYPE_VALUE tv; @@ -2246,7 +2246,7 @@ void player_outfit(void) q_ptr = &forge; /* Give the player some food */ - switch (p_ptr->prace) + switch (creature_ptr->prace) { case RACE_VAMPIRE: /* Nothing! */ @@ -2309,7 +2309,7 @@ void player_outfit(void) } q_ptr = &forge; - if ((p_ptr->prace == RACE_VAMPIRE) && (p_ptr->pclass != CLASS_NINJA)) + if ((creature_ptr->prace == RACE_VAMPIRE) && (creature_ptr->pclass != CLASS_NINJA)) { /* Hack -- Give the player scrolls of DARKNESS! */ object_prep(q_ptr, lookup_kind(TV_SCROLL, SV_SCROLL_DARKNESS)); @@ -2318,7 +2318,7 @@ void player_outfit(void) add_outfit(q_ptr); } - else if (p_ptr->pclass != CLASS_NINJA) + else if (creature_ptr->pclass != CLASS_NINJA) { /* Hack -- Give the player some torches */ object_prep(q_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH)); @@ -2329,14 +2329,14 @@ void player_outfit(void) } q_ptr = &forge; - if (p_ptr->prace == RACE_MERFOLK) + if (creature_ptr->prace == RACE_MERFOLK) { object_prep(q_ptr, lookup_kind(TV_RING, SV_RING_LEVITATION_FALL)); q_ptr->number = 1; add_outfit(q_ptr); } - if ((p_ptr->pclass == CLASS_RANGER) || (p_ptr->pclass == CLASS_CAVALRY)) + if ((creature_ptr->pclass == CLASS_RANGER) || (creature_ptr->pclass == CLASS_CAVALRY)) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL)); @@ -2344,14 +2344,14 @@ void player_outfit(void) add_outfit(q_ptr); } - if (p_ptr->pclass == CLASS_RANGER) + if (creature_ptr->pclass == CLASS_RANGER) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_BOW, SV_SHORT_BOW)); add_outfit(q_ptr); } - else if (p_ptr->pclass == CLASS_ARCHER) + else if (creature_ptr->pclass == CLASS_ARCHER) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_ARROW, SV_AMMO_NORMAL)); @@ -2359,7 +2359,7 @@ void player_outfit(void) add_outfit(q_ptr); } - else if (p_ptr->pclass == CLASS_HIGH_MAGE) + else if (creature_ptr->pclass == CLASS_HIGH_MAGE) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_WAND, SV_WAND_MAGIC_MISSILE)); @@ -2368,7 +2368,7 @@ void player_outfit(void) add_outfit(q_ptr); } - else if (p_ptr->pclass == CLASS_SORCERER) + else if (creature_ptr->pclass == CLASS_SORCERER) { OBJECT_TYPE_VALUE book_tval; for (book_tval = TV_LIFE_BOOK; book_tval <= TV_LIFE_BOOK+MAX_MAGIC-1; book_tval++) @@ -2380,9 +2380,9 @@ void player_outfit(void) add_outfit(q_ptr); } } - else if (p_ptr->pclass == CLASS_TOURIST) + else if (creature_ptr->pclass == CLASS_TOURIST) { - if (p_ptr->pseikaku != SEIKAKU_SEXY) + if (creature_ptr->pseikaku != SEIKAKU_SEXY) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_SHOT, SV_AMMO_LIGHT)); @@ -2416,7 +2416,7 @@ void player_outfit(void) add_outfit(q_ptr); } - else if (p_ptr->pclass == CLASS_NINJA) + else if (creature_ptr->pclass == CLASS_NINJA) { /* Hack -- Give the player some arrows */ object_prep(q_ptr, lookup_kind(TV_SPIKE, 0)); @@ -2424,7 +2424,7 @@ void player_outfit(void) add_outfit(q_ptr); } - else if (p_ptr->pclass == CLASS_SNIPER) + else if (creature_ptr->pclass == CLASS_SNIPER) { /* Hack -- Give the player some bolts */ object_prep(q_ptr, lookup_kind(TV_BOLT, SV_AMMO_NORMAL)); @@ -2433,30 +2433,30 @@ void player_outfit(void) add_outfit(q_ptr); } - if(p_ptr->pseikaku == SEIKAKU_SEXY) + if(creature_ptr->pseikaku == SEIKAKU_SEXY) { - player_init[p_ptr->pclass][2][0] = TV_HAFTED; - player_init[p_ptr->pclass][2][1] = SV_WHIP; + player_init[creature_ptr->pclass][2][0] = TV_HAFTED; + player_init[creature_ptr->pclass][2][1] = SV_WHIP; } /* Hack -- Give the player three useful objects */ for (i = 0; i < 3; i++) { /* Look up standard equipment */ - tv = player_init[p_ptr->pclass][i][0]; - sv = player_init[p_ptr->pclass][i][1]; + tv = player_init[creature_ptr->pclass][i][0]; + sv = player_init[creature_ptr->pclass][i][1]; - if ((p_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue; + if ((creature_ptr->prace == RACE_ANDROID) && ((tv == TV_SOFT_ARMOR) || (tv == TV_HARD_ARMOR))) continue; /* Hack to initialize spellbooks */ - if (tv == TV_SORCERY_BOOK) tv = TV_LIFE_BOOK + p_ptr->realm1 - 1; - else if (tv == TV_DEATH_BOOK) tv = TV_LIFE_BOOK + p_ptr->realm2 - 1; + if (tv == TV_SORCERY_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm1 - 1; + else if (tv == TV_DEATH_BOOK) tv = TV_LIFE_BOOK + creature_ptr->realm2 - 1; else if (tv == TV_RING && sv == SV_RING_RES_FEAR && - p_ptr->prace == RACE_BARBARIAN) + creature_ptr->prace == RACE_BARBARIAN) /* Barbarians do not need a ring of resist fear */ sv = SV_RING_SUSTAIN_STR; - else if (tv == TV_RING && sv == SV_RING_SUSTAIN_INT && p_ptr->prace == RACE_MIND_FLAYER) + else if (tv == TV_RING && sv == SV_RING_SUSTAIN_INT && creature_ptr->prace == RACE_MIND_FLAYER) { tv = TV_POTION; sv = SV_POTION_RESTORE_MANA; @@ -2467,8 +2467,8 @@ void player_outfit(void) object_prep(q_ptr, lookup_kind(tv, sv)); /* Assassins begin the game with a poisoned dagger */ - if ((tv == TV_SWORD || tv == TV_HAFTED) && (p_ptr->pclass == CLASS_ROGUE && - p_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */ + if ((tv == TV_SWORD || tv == TV_HAFTED) && (creature_ptr->pclass == CLASS_ROGUE && + creature_ptr->realm1 == REALM_DEATH)) /* Only assassins get a poisoned weapon */ { q_ptr->name2 = EGO_BRAND_POIS; } diff --git a/src/birth.h b/src/birth.h index 700dd54a8..a73fd8b11 100644 --- a/src/birth.h +++ b/src/birth.h @@ -41,6 +41,6 @@ extern void add_history_from_pref_line(concptr t); extern void player_birth(player_type *creature_ptr); extern void get_max_stats(player_type *creature_ptr); extern void get_height_weight(player_type *creature_ptr); -extern void player_outfit(void); +extern void player_outfit(player_type *creature_ptr); extern void dump_yourself(player_type *creature_ptr, FILE *fff); diff --git a/src/core.c b/src/core.c index a2db674ba..4cf3c3c1c 100644 --- a/src/core.c +++ b/src/core.c @@ -5565,7 +5565,7 @@ void play_game(bool new_game) /* Give startup outfit (after loading pref files) */ if (new_game) { - player_outfit(); + player_outfit(p_ptr); } /* React to changes */ diff --git a/src/wizard2.c b/src/wizard2.c index bfbfc5638..2d97a92d6 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1948,7 +1948,7 @@ void do_cmd_debug(void) { if(p_ptr->inventory_list[i].k_idx) inven_drop(i, 999); } - player_outfit(); + player_outfit(p_ptr); break; } -- 2.11.0