OSDN Git Service

[Refactor] #37353 マジックナンバー修正(A_MAX) / Fix magic number (A_MAX).
[hengband/hengband.git] / src / cmd-activate.c
index 64d2948..5be685f 100644 (file)
@@ -366,19 +366,26 @@ void do_cmd_activate(void)
        OBJECT_IDX item;
        cptr q, s;
 
+       if (p_ptr->wild_mode) return;
+
+       if (p_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return;
+       }
+
        if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
        {
                set_action(ACTION_NONE);
        }
 
-       item_tester_no_ryoute = TRUE;
-       /* Prepare the hook */
        item_tester_hook = item_tester_hook_activate;
 
        q = _("どのアイテムを始動させますか? ", "Activate which item? ");
        s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP))) return;
+       if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
 
        /* Activate the item */
        do_cmd_activate_aux(item);
@@ -927,14 +934,14 @@ bool activate_artifact(object_type *o_ptr)
 
        case ACT_SUMMON_ANIMAL:
        {
-               (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
                break;
        }
 
        case ACT_SUMMON_PHANTOM:
        {
                msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
-               (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
                break;
        }
 
@@ -947,7 +954,7 @@ bool activate_artifact(object_type *o_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= PM_NO_PET;
 
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode))
+               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
                {
                        msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
                        if (pet)
@@ -977,7 +984,7 @@ bool activate_artifact(object_type *o_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
 
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode))
+               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
                {
                        msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
                                "Cold winds begin to blow around you, carrying with them the stench of decay..."));
@@ -999,7 +1006,7 @@ bool activate_artifact(object_type *o_ptr)
                if (pet) mode |= PM_FORCE_PET;
                else mode |= PM_NO_PET;
 
-               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode))
+               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
                {
 
                        if (pet)
@@ -1016,7 +1023,7 @@ bool activate_artifact(object_type *o_ptr)
        case ACT_SUMMON_DAWN:
        {
                msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
-               (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
+               (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
                break;
        }
 
@@ -1485,25 +1492,19 @@ bool activate_artifact(object_type *o_ptr)
 
                                msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
                                /* Hack -- Bypass free action */
-                               (void)set_paralyzed(p_ptr->paralyzed +
-                                       randint1(5 * oops + 1));
+                               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
 
                                /* Confusing. */
-                               (void)set_confused(p_ptr->confused +
-                                       randint1(5 * oops + 1));
+                               (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
                        }
-
-                       /* Redraw mana */
                        p_ptr->redraw |= (PR_MANA);
                }
                take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
                /* Confusing. */
-               if (one_in_(5)) (void)set_confused(p_ptr->confused +
-                       randint1(10));
+               if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
 
                /* Exercise a little care... */
-               if (one_in_(20))
-                       take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
+               if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
                break;
        }
 
@@ -1552,7 +1553,7 @@ bool activate_artifact(object_type *o_ptr)
                INVENTORY_IDX inv;
                int t;
                OBJECT_IDX o_idx;
-               char o_name[MAX_NLEN];
+               GAME_TEXT o_name[MAX_NLEN];
                object_type forge;
 
                /* Cast off activated item */
@@ -1632,7 +1633,7 @@ bool activate_artifact(object_type *o_ptr)
                if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               tsuri_dir = dir;
+               p_ptr->fishing_dir = dir;
                if (!cave_have_flag_bold(y, x, FF_WATER))
                {
                        msg_print(_("そこは水辺ではない。", "There is no fishing place."));
@@ -1640,7 +1641,7 @@ bool activate_artifact(object_type *o_ptr)
                }
                else if (cave[y][x].m_idx)
                {
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
                        msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
                        p_ptr->energy_use = 0;
@@ -1838,7 +1839,7 @@ void get_bloody_moon_flags(object_type *o_ptr)
        for (i = 0; i < 2; i++)
        {
                int tmp = randint0(11);
-               if (tmp < 6) add_flag(o_ptr->art_flags, TR_STR + tmp);
+               if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
                else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
        }
 }