OSDN Git Service

[Refactor] #38997 identify_fully() にplayer_type * 引数を追加 / Added player_type * argumen...
[hengband/hengband.git] / src / cmd / cmd-activate.c
index 36b896f..e76347d 100644 (file)
@@ -466,7 +466,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                        for (i = 0; i < max_pet; i++)
                        {
                                pet_ctr = who[i];
-                               teleport_monster_to(pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
+                               teleport_monster_to(user_ptr, pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
                        }
 
                        /* Free the "who" array */
@@ -536,7 +536,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
                else
                {
                        success = FALSE;
-                       if (!get_direction(&dir, FALSE, FALSE)) return;
+                       if (!get_direction(user_ptr, &dir, FALSE, FALSE)) return;
                        if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
                                if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
@@ -619,6 +619,7 @@ void exe_activate(player_type *user_ptr, INVENTORY_IDX item)
 
 /*!
  * @brief 装備を発動するコマンドのメインルーチン /
+ * @param user_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 void do_cmd_activate(player_type *user_ptr)
@@ -648,6 +649,7 @@ void do_cmd_activate(player_type *user_ptr)
 /*!
 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
+* @param user_ptr プレーヤーへの参照ポインタ
 * @param o_ptr 対象のオブジェクト構造体ポインタ
 * @return 発動実行の是非を返す。
 */
@@ -680,7 +682,7 @@ static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
 
        t = randint0(n);
        msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
-       fire_breath(type[t], dir, 250, 4);
+       fire_breath(user_ptr, type[t], dir, 250, 4);
 
        return TRUE;
 }
@@ -688,6 +690,7 @@ static bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
 
 /*!
  * @brief アイテムの発動効果を処理する。
+ * @param user_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 対象のオブジェクト構造体ポインタ
  * @return 発動実行の是非を返す。
  */
@@ -711,7 +714,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
-               (void)lite_line(dir, damroll(6, 8));
+               (void)lite_line(user_ptr, dir, damroll(6, 8));
                break;
        }
 
@@ -855,7 +858,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
                if (!get_aim_dir(&dir)) return FALSE;
-               if (hypodynamic_bolt(dir, 100))
+               if (hypodynamic_bolt(user_ptr, dir, 100))
                        break;
        }
 
@@ -863,7 +866,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("黒く輝いている...", "It glows black..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               hypodynamic_bolt(dir, 120);
+               hypodynamic_bolt(user_ptr, dir, 120);
                break;
        }
 
@@ -872,7 +875,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if (!get_aim_dir(&dir)) return FALSE;
                for (dummy = 0; dummy < 3; dummy++)
                {
-                       if (hypodynamic_bolt(dir, 50))
+                       if (hypodynamic_bolt(user_ptr, dir, 50))
                                hp_player(user_ptr, 50);
                }
                break;
@@ -897,7 +900,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if (!get_aim_dir(&dir)) return FALSE;
                for (dummy = 0; dummy < 3; dummy++)
                {
-                       if (hypodynamic_bolt(dir, 100))
+                       if (hypodynamic_bolt(user_ptr, dir, 100))
                                hp_player(user_ptr, 100);
                }
                break;
@@ -907,7 +910,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CALL_CHAOS:
        {
                msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
-               call_chaos();
+               call_chaos(user_ptr);
                break;
        }
 
@@ -922,7 +925,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_DISP_EVIL:
        {
                msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
-               dispel_evil(user_ptr->lev * 5);
+               dispel_evil(user_ptr, user_ptr->lev * 5);
                break;
        }
 
@@ -930,14 +933,14 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-               fire_breath(GF_MISSILE, dir, 300, 4);
+               fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
                break;
        }
 
        case ACT_DISP_GOOD:
        {
                msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
-               dispel_good(user_ptr->lev * 5);
+               dispel_good(user_ptr, user_ptr->lev * 5);
                break;
        }
 
@@ -976,7 +979,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_PESTICIDE:
        {
                msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
-               (void)dispel_monsters(4);
+               (void)dispel_monsters(user_ptr, 4);
                break;
        }
 
@@ -984,7 +987,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
                fire_ball(user_ptr, GF_LITE, 0, 300, 6);
-               confuse_monsters(3 * user_ptr->lev / 2);
+               confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
                break;
        }
 
@@ -1008,12 +1011,12 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
                        while (attempts--)
                        {
-                               scatter(&y, &x, user_ptr->y, user_ptr->x, 4, 0);
-                               if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
+                               scatter(user_ptr->current_floor_ptr, &y, &x, user_ptr->y, user_ptr->x, 4, 0);
+                               if (!cave_have_flag_bold(user_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
                                if (!player_bold(user_ptr, y, x)) break;
                        }
 
-                       project(0, 3, y, x, 150, GF_ELEC,
+                       project(user_ptr, 0, 3, y, x, 150, GF_ELEC,
                                (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                }
 
@@ -1024,7 +1027,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                if (!get_aim_dir(&dir)) return FALSE;
                msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
-               fire_breath(GF_MISSILE, dir, 300, 4);
+               fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
                msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
                (void)set_afraid(user_ptr, 0);
                (void)set_hero(user_ptr, randint1(50) + 50, FALSE);
@@ -1041,7 +1044,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_BR_FIRE:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_breath(GF_FIRE, dir, 200, 2);
+               fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
                {
                        (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
@@ -1052,7 +1055,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_BR_COLD:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               fire_breath(GF_COLD, dir, 200, 2);
+               fire_breath(user_ptr, GF_COLD, dir, 200, 2);
                if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
                {
                        (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
@@ -1078,7 +1081,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_SLEEP:
        {
                msg_print(_("深青色に輝いている...", "It glows deep blue..."));
-               sleep_monsters_touch();
+               sleep_monsters_touch(user_ptr);
                break;
        }
 
@@ -1090,20 +1093,20 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_TERROR:
        {
-               turn_monsters(40 + user_ptr->lev);
+               turn_monsters(user_ptr, 40 + user_ptr->lev);
                break;
        }
 
        case ACT_TELE_AWAY:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)fire_beam(GF_AWAY_ALL, dir, plev);
+               (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, plev);
                break;
        }
 
        case ACT_BANISH_EVIL:
        {
-               if (banish_evil(100))
+               if (banish_evil(user_ptr, 100))
                {
                        msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
                }
@@ -1130,7 +1133,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                if (hex_spelling_any(user_ptr)) stop_hex_spell_all(user_ptr);
                msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
                        "You wind a mighty blast; your enemies tremble!"));
-               (void)turn_monsters((3 * user_ptr->lev / 2) + 10);
+               (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
                break;
        }
 
@@ -1144,7 +1147,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                {
                        msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
                }
-               aggravate_monsters(0);
+               aggravate_monsters(user_ptr, 0);
                break;
        }
 
@@ -1153,33 +1156,33 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_CHARM_ANIMAL:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)charm_animal(dir, plev);
+               (void)charm_animal(user_ptr, dir, plev);
                break;
        }
 
        case ACT_CHARM_UNDEAD:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)control_one_undead(dir, plev);
+               (void)control_one_undead(user_ptr, dir, plev);
                break;
        }
 
        case ACT_CHARM_OTHER:
        {
                if (!get_aim_dir(&dir)) return FALSE;
-               (void)charm_monster(dir, plev * 2);
+               (void)charm_monster(user_ptr, dir, plev * 2);
                break;
        }
 
        case ACT_CHARM_ANIMALS:
        {
-               (void)charm_animals(plev * 2);
+               (void)charm_animals(user_ptr, plev * 2);
                break;
        }
 
        case ACT_CHARM_OTHERS:
        {
-               charm_monsters(plev * 2);
+               charm_monsters(user_ptr, plev * 2);
                break;
        }
 
@@ -1434,7 +1437,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_LIGHT:
        {
                msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
-               lite_area(damroll(2, 15), 3);
+               lite_area(user_ptr, damroll(2, 15), 3);
                break;
        }
 
@@ -1442,7 +1445,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("眩しく輝いた...", "It shines brightly..."));
                map_area(user_ptr, DETECT_RAD_MAP);
-               lite_area(damroll(2, 15), 3);
+               lite_area(user_ptr, damroll(2, 15), 3);
                break;
        }
 
@@ -1450,23 +1453,23 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("白く明るく輝いている...", "It glows bright white..."));
                msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
-               detect_all(DETECT_RAD_DEFAULT);
+               detect_all(user_ptr, DETECT_RAD_DEFAULT);
                break;
        }
 
        case ACT_DETECT_XTRA:
        {
                msg_print(_("明るく輝いている...", "It glows brightly..."));
-               detect_all(DETECT_RAD_DEFAULT);
-               probing();
-               identify_fully(FALSE);
+               detect_all(user_ptr, DETECT_RAD_DEFAULT);
+               probing(user_ptr);
+               identify_fully(user_ptr, FALSE);
                break;
        }
 
        case ACT_ID_FULL:
        {
                msg_print(_("黄色く輝いている...", "It glows yellow..."));
-               identify_fully(FALSE);
+               identify_fully(user_ptr, FALSE);
                break;
        }
 
@@ -1499,7 +1502,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_DEST_DOOR:
        {
                msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
-               destroy_doors_touch();
+               destroy_doors_touch(user_ptr);
                break;
        }
 
@@ -1507,20 +1510,20 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_print(_("鼓動している...", "It pulsates..."));
                if (!get_aim_dir(&dir)) return FALSE;
-               wall_to_mud(dir, 20 + randint1(30));
+               wall_to_mud(user_ptr, dir, 20 + randint1(30));
                break;
        }
 
        case ACT_RECHARGE:
        {
-               recharge(130);
+               recharge(user_ptr, 130);
                break;
        }
 
        case ACT_ALCHEMY:
        {
                msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
-               (void)alchemy();
+               (void)alchemy(user_ptr);
                break;
        }
 
@@ -1556,9 +1559,9 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
                take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
 
-               (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
-               (void)detect_doors(DETECT_RAD_DEFAULT);
-               (void)detect_stairs(DETECT_RAD_DEFAULT);
+               (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
+               (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
+               (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
 
                if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
                {
@@ -1616,7 +1619,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                default:
                        if (get_check(_("この階を去りますか?", "Leave this level? ")))
                        {
-                               if (autosave_l) do_cmd_save_game(TRUE);
+                               if (autosave_l) do_cmd_save_game(user_ptr, TRUE);
                                user_ptr->leaving = TRUE;
                        }
                }
@@ -1627,21 +1630,21 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        {
                msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
                (void)remove_all_curse(user_ptr);
-               (void)probing();
+               (void)probing(user_ptr);
                break;
        }
 
        case ACT_BRAND_FIRE_BOLTS:
        {
                msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
-               (void)brand_bolts();
+               brand_bolts(user_ptr);
                break;
        }
 
        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;
        }
 
@@ -1655,7 +1658,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
                msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
                (void)set_afraid(user_ptr, 0);
                (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
-               dispel_evil(user_ptr->lev * 3);
+               dispel_evil(user_ptr, user_ptr->lev * 3);
                break;
        }
 
@@ -1667,8 +1670,8 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
 
        case ACT_DETECT_ALL_MONS:
        {
-               (void)detect_monsters_invis(255);
-               (void)detect_monsters_normal(255);
+               (void)detect_monsters_invis(user_ptr, 255);
+               (void)detect_monsters_normal(user_ptr, 255);
                break;
        }
 
@@ -1703,7 +1706,7 @@ bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
        case ACT_GRAND_CROSS:
        {
                msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
-               project(0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
+               project(user_ptr, 0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
                break;
        }