OSDN Git Service

[Refactor] #38997 recharge() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:33:38 +0000 (23:33 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:33:38 +0000 (23:33 +0900)
src/cmd/cmd-activate.c
src/cmd/cmd-read.c
src/realm-chaos.c
src/realm-hex.c
src/realm-sorcery.c
src/spells.h
src/spells3.c

index f367d37..13d957f 100644 (file)
@@ -1513,7 +1513,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_RECHARGE:
        {
-               recharge(130);
+               recharge(user_ptr, 130);
                break;
        }
 
@@ -1641,7 +1641,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_RECHARGE_XTRA:
        {
                msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
-               if (!recharge(1000)) return FALSE;
+               if (!recharge(user_ptr, 1000)) return FALSE;
                break;
        }
 
index 27f975e..f3f60b5 100644 (file)
@@ -262,7 +262,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
 
                case SV_SCROLL_RECHARGING:
                {
-                       if (!recharge(130)) used_up = FALSE;
+                       if (!recharge(creature_ptr, 130)) used_up = FALSE;
                        ident = TRUE;
                        break;
                }
index c0adb15..1f4ccc5 100644 (file)
@@ -377,7 +377,7 @@ concptr do_chaos_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                        if (info) return info_power(power);
                        if (cast)
                        {
-                               if (!recharge(power)) return NULL;
+                               if (!recharge(caster_ptr, power)) return NULL;
                        }
                }
                break;
index 2563404..47e1355 100644 (file)
@@ -697,7 +697,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
                if (info) return info_power(power);
                if (cast)
                {
-                       if (!recharge(power)) return NULL;
+                       if (!recharge(caster_ptr, power)) return NULL;
                        add = FALSE;
                }
                break;
index 92be363..0ebc93f 100644 (file)
@@ -160,7 +160,7 @@ concptr do_sorcery_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mod
 
                        if (cast)
                        {
-                               if (!recharge(power)) return NULL;
+                               if (!recharge(caster_ptr, power)) return NULL;
                        }
                }
                break;
index fce2013..89adc7c 100644 (file)
@@ -309,7 +309,7 @@ extern bool ident_spell(player_type *caster_ptr, bool only_equip);
 extern bool mundane_spell(player_type *ownner_ptr, bool only_equip);
 extern bool identify_item(player_type *owner_ptr, object_type *o_ptr);
 extern bool identify_fully(bool only_equip);
-extern bool recharge(int power);
+extern bool recharge(player_type *caster_ptr, int power);
 extern void display_spell_list(player_type *caster_ptr);
 extern EXP experience_of_spell(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm);
 extern MANA_POINT mod_need_mana(MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm);
index a94c107..9131483 100644 (file)
@@ -1915,7 +1915,7 @@ bool identify_fully(bool only_equip)
  *
  * Beware of "sliding index errors".
  */
-bool recharge(int power)
+bool recharge(player_type *caster_ptr, int power)
 {
        OBJECT_IDX item;
        DEPTH lev;
@@ -1937,7 +1937,7 @@ bool recharge(int power)
        q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
        s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
 
-       o_ptr = choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
+       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
        if (!o_ptr) return (FALSE);
 
        /* Get the object kind. */
@@ -2058,7 +2058,7 @@ bool recharge(int power)
                        /*** Determine Seriousness of Failure ***/
 
                        /* Mages recharge objects more safely. */
-                       if (IS_WIZARD_CLASS(p_ptr) || p_ptr->pclass == CLASS_MAGIC_EATER || p_ptr->pclass == CLASS_BLUE_MAGE)
+                       if (IS_WIZARD_CLASS(caster_ptr) || caster_ptr->pclass == CLASS_MAGIC_EATER || caster_ptr->pclass == CLASS_BLUE_MAGE)
                        {
                                /* 10% chance to blow up one rod, otherwise draining. */
                                if (o_ptr->tval == TV_ROD)
@@ -2149,8 +2149,8 @@ bool recharge(int power)
                        }
                }
        }
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
-       p_ptr->window |= (PW_INVEN);
+       caster_ptr->update |= (PU_COMBINE | PU_REORDER);
+       caster_ptr->window |= (PW_INVEN);
 
        /* Something was done */
        return (TRUE);