From 09afe8b1ab18c690ecd795af32077132a626464d Mon Sep 17 00:00:00 2001 From: deskull Date: Sat, 14 Dec 2019 15:24:16 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20ident=5Fspell()=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=20/=20Add=20player=5Ftype=20*=20argu?= =?utf8?q?ment=20to=20ident=5Fspell().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/bldg.c | 2 +- src/cmd/cmd-activate.c | 2 +- src/cmd/cmd-read.c | 2 +- src/cmd/cmd-usestaff.c | 2 +- src/cmd/cmd-zaprod.c | 2 +- src/mind.c | 4 ++-- src/racial.c | 2 +- src/realm-arcane.c | 2 +- src/realm-death.c | 2 +- src/realm-hissatsu.c | 2 +- src/realm-life.c | 2 +- src/realm-sorcery.c | 2 +- src/spells-object.c | 2 +- src/spells.h | 2 +- src/spells3.c | 6 +++--- src/wizard2.c | 2 +- 16 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bldg.c b/src/bldg.c index f27acddf9..7ae447c14 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -3962,7 +3962,7 @@ static void bldg_process_command(building_type *bldg, int i) paid = TRUE; break; case BACT_IDENT_ONE: /* needs work */ - paid = ident_spell(FALSE); + paid = ident_spell(p_ptr, FALSE); break; case BACT_LEARN: do_cmd_study(p_ptr); diff --git a/src/cmd/cmd-activate.c b/src/cmd/cmd-activate.c index 3d1eec0ec..15c66675a 100644 --- a/src/cmd/cmd-activate.c +++ b/src/cmd/cmd-activate.c @@ -1472,7 +1472,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr) case ACT_ID_PLAIN: { - if (!ident_spell(FALSE)) return FALSE; + if (!ident_spell(user_ptr, FALSE)) return FALSE; break; } diff --git a/src/cmd/cmd-read.c b/src/cmd/cmd-read.c index 4965859cb..a62609cca 100644 --- a/src/cmd/cmd-read.c +++ b/src/cmd/cmd-read.c @@ -195,7 +195,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) case SV_SCROLL_IDENTIFY: { - if (!ident_spell(FALSE)) used_up = FALSE; + if (!ident_spell(creature_ptr, FALSE)) used_up = FALSE; ident = TRUE; break; } diff --git a/src/cmd/cmd-usestaff.c b/src/cmd/cmd-usestaff.c index b764b9e1b..ffc080f8c 100644 --- a/src/cmd/cmd-usestaff.c +++ b/src/cmd/cmd-usestaff.c @@ -86,7 +86,7 @@ int staff_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, bool *use if (!identify_fully(FALSE)) *use_charge = FALSE; } else { - if (!ident_spell(FALSE)) *use_charge = FALSE; + if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE; } ident = TRUE; break; diff --git a/src/cmd/cmd-zaprod.c b/src/cmd/cmd-zaprod.c index c22c5ee82..936a9640f 100644 --- a/src/cmd/cmd-zaprod.c +++ b/src/cmd/cmd-zaprod.c @@ -57,7 +57,7 @@ int rod_effect(player_type *creature_ptr, OBJECT_SUBTYPE_VALUE sval, DIRECTION d if (!identify_fully(FALSE)) *use_charge = FALSE; } else { - if (!ident_spell(FALSE)) *use_charge = FALSE; + if (!ident_spell(creature_ptr, FALSE)) *use_charge = FALSE; } ident = TRUE; break; diff --git a/src/mind.c b/src/mind.c index f772097da..b7b5329a2 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1115,7 +1115,7 @@ static bool cast_mindcrafter_spell(player_type *caster_ptr, int spell) if (plev < 25) return psychometry(); else - return ident_spell(FALSE); + return ident_spell(caster_ptr, FALSE); case 8: /* Mindwave */ msg_print(_("精神を捻じ曲げる波動を発生させた!", "Mind-warping forces emanate from your brain!")); @@ -1596,7 +1596,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell) break; } case 7: - return ident_spell(FALSE); + return ident_spell(caster_ptr, FALSE); case 8: set_tim_levitation(caster_ptr, randint1(20) + 20, FALSE); break; diff --git a/src/racial.c b/src/racial.c index 25cf24795..38387521c 100644 --- a/src/racial.c +++ b/src/racial.c @@ -605,7 +605,7 @@ static bool exe_racial_power(player_type *creature_ptr, s32b command) } else { - if (!ident_spell(TRUE)) return FALSE; + if (!ident_spell(creature_ptr, TRUE)) return FALSE; } break; } diff --git a/src/realm-arcane.c b/src/realm-arcane.c index eeded9dd3..0284c2e61 100644 --- a/src/realm-arcane.c +++ b/src/realm-arcane.c @@ -351,7 +351,7 @@ concptr do_arcane_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode { if (cast) { - if (!ident_spell(FALSE)) return NULL; + if (!ident_spell(caster_ptr, FALSE)) return NULL; } } break; diff --git a/src/realm-death.c b/src/realm-death.c index a61e3d1b6..21cf8a631 100644 --- a/src/realm-death.c +++ b/src/realm-death.c @@ -540,7 +540,7 @@ concptr do_death_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) { if (randint1(50) > plev) { - if (!ident_spell(FALSE)) return NULL; + if (!ident_spell(caster_ptr, FALSE)) return NULL; } else { diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 83eabfcb2..f52c777c1 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -350,7 +350,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo } else { - if (!ident_spell(TRUE)) return NULL; + if (!ident_spell(caster_ptr, TRUE)) return NULL; } } break; diff --git a/src/realm-life.c b/src/realm-life.c index 84a12baf8..4970fe24d 100644 --- a/src/realm-life.c +++ b/src/realm-life.c @@ -259,7 +259,7 @@ concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode) { if (cast) { - if (!ident_spell(FALSE)) return NULL; + if (!ident_spell(caster_ptr, FALSE)) return NULL; } } break; diff --git a/src/realm-sorcery.c b/src/realm-sorcery.c index 5ebe5d31a..2c79de6a2 100644 --- a/src/realm-sorcery.c +++ b/src/realm-sorcery.c @@ -188,7 +188,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod { if (cast) { - if (!ident_spell(FALSE)) return NULL; + if (!ident_spell(caster_ptr, FALSE)) return NULL; } } break; diff --git a/src/spells-object.c b/src/spells-object.c index 1e941e3f3..95286e931 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -824,7 +824,7 @@ bool brand_bolts(void) bool perilous_secrets(player_type *user_ptr) { - if (!ident_spell(FALSE)) return FALSE; + if (!ident_spell(user_ptr, FALSE)) return FALSE; if (mp_ptr->spell_book) { diff --git a/src/spells.h b/src/spells.h index f0e03ae9c..442de3b95 100644 --- a/src/spells.h +++ b/src/spells.h @@ -305,7 +305,7 @@ extern int remove_all_curse(player_type *caster_ptr); extern bool alchemy(void); extern bool artifact_scroll(void); -extern bool ident_spell(bool only_equip); +extern bool ident_spell(player_type *caster_ptr, bool only_equip); extern bool mundane_spell(bool only_equip); extern bool identify_item(object_type *o_ptr); extern bool identify_fully(bool only_equip); diff --git a/src/spells3.c b/src/spells3.c index 37fdf92bf..7b0bad6f2 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -1733,12 +1733,12 @@ bool identify_item(object_type *o_ptr) * This routine does *not* automatically combine objects. * Returns TRUE if something was identified, else FALSE. */ -bool ident_spell(bool only_equip) +bool ident_spell(player_type *caster_ptr, bool only_equip) { OBJECT_IDX item; object_type *o_ptr; GAME_TEXT o_name[MAX_NLEN]; - concptr q, s; + concptr q, s; bool old_known; if (only_equip) @@ -1762,7 +1762,7 @@ bool ident_spell(bool only_equip) s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); - o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); if (!o_ptr) return (FALSE); old_known = identify_item(o_ptr); diff --git a/src/wizard2.c b/src/wizard2.c index b7b0c0458..bc0481be3 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1863,7 +1863,7 @@ void do_cmd_debug(player_type *creature_ptr) /* Identify */ case 'i': - (void)ident_spell(FALSE); + (void)ident_spell(creature_ptr, FALSE); break; /* Go up or down in the dungeon */ -- 2.11.0