OSDN Git Service

[Refactor] #38824 get_item() を choose_object() に置換完了。 / Replaced get_item() to choose...
[hengband/hengband.git] / src / spells3.c
index 4767bc1..450cf07 100644 (file)
@@ -14,6 +14,7 @@
 #include "angband.h"
 #include "object-hook.h"
 #include "melee.h"
+#include "player-status.h"
 
 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
 #define MAX_TRIES 100
@@ -118,13 +119,8 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
        /* Forget the counter target */
        reset_target(m_ptr);
 
-       /* Update the monster (new location) */
        update_monster(m_idx, TRUE);
-
-       /* Redraw the old grid */
        lite_spot(oy, ox);
-
-       /* Redraw the new grid */
        lite_spot(ny, nx);
 
        if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
@@ -223,13 +219,8 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
        m_ptr->fy = ny;
        m_ptr->fx = nx;
 
-       /* Update the monster (new location) */
        update_monster(m_idx, TRUE);
-
-       /* Redraw the old grid */
        lite_spot(oy, ox);
-
-       /* Redraw the new grid */
        lite_spot(ny, nx);
 
        if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
@@ -575,7 +566,7 @@ void teleport_away_followable(MONSTER_IDX m_idx)
 void teleport_level(MONSTER_IDX m_idx)
 {
        bool         go_up;
-       char         m_name[160];
+       GAME_TEXT m_name[160];
        bool         see_m = TRUE;
 
        if (m_idx <= 0) /* To player */
@@ -731,7 +722,7 @@ void teleport_level(MONSTER_IDX m_idx)
 
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                {
-                       char m2_name[80];
+                       char m2_name[MAX_NLEN];
 
                        monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
                        do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
@@ -933,7 +924,7 @@ bool reset_recall(void)
                        do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
                                        /* Accept request */
 #ifdef JP
-msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
+               msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
 #else
                msg_format("Recall depth set to level %d (%d').", dummy, dummy * 50);
 #endif
@@ -958,7 +949,7 @@ bool apply_disenchant(BIT_FLAGS mode)
 {
        int             t = 0;
        object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        int to_h, to_d, to_a, pval;
 
        /* Pick a random slot */
@@ -1046,8 +1037,6 @@ msg_format("%s(%c)は劣化を跳ね返した!",o_name, index_to_label(t) );
 
                chg_virtue(V_HARMONY, 1);
                chg_virtue(V_ENCHANT, -2);
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
                p_ptr->window |= (PW_EQUIP | PW_PLAYER);
@@ -1207,25 +1196,12 @@ void brand_weapon(int brand_type)
 
        /* Assume enchant weapon */
        item_tester_hook = object_allow_enchant_melee_weapon;
-       item_tester_no_ryoute = TRUE;
 
        q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
        s = _("強化できる武器がない。", "You have nothing to enchant.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP))) return;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return;
 
        /* you can never modify artifacts / ego-items */
        /* you can never modify cursed items */
@@ -1239,7 +1215,7 @@ void brand_weapon(int brand_type)
                cptr act = NULL;
 
                /* Let's get the name before it is changed... */
-               char o_name[MAX_NLEN];
+               GAME_TEXT o_name[MAX_NLEN];
                object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
                switch (brand_type)
@@ -1361,7 +1337,7 @@ static bool vanish_dungeon(void)
        cave_type *c_ptr;
        feature_type *f_ptr;
        monster_type *m_ptr;
-       char m_name[80];
+       GAME_TEXT m_name[MAX_NLEN];
 
        /* Prevent vasishing of quest levels and town */
        if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
@@ -1472,15 +1448,8 @@ static bool vanish_dungeon(void)
        }
 
        /* Mega-Hack -- Forget the view and lite */
-       p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
-
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
-
-       /* Update the monsters */
-       p_ptr->update |= (PU_MONSTERS);
-
+       p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
        p_ptr->redraw |= (PR_MAP);
-
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
        return TRUE;
@@ -1540,13 +1509,12 @@ void call_the_(void)
 #ifdef JP
                msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!",
                        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文"));
-               msg_print("大きな爆発音があった!");
 #else
                msg_format("You %s the %s too close to a wall!",
                        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
                        ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell"));
-               msg_print("There is a loud explosion!");
 #endif
+               msg_print(_("大きな爆発音があった!", "There is a loud explosion!"));
 
                if (one_in_(666))
                {
@@ -1579,7 +1547,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        OBJECT_IDX i;
        cave_type *c_ptr;
        object_type *o_ptr;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
        if (cave[p_ptr->y][p_ptr->x].o_idx)
@@ -1633,10 +1601,8 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        }
        else
        {
-               /* Use a direction */
-               ty = p_ptr->y; /* Where to drop the item */
+               ty = p_ptr->y; 
                tx = p_ptr->x;
-
                do
                {
                        ty += ddy[dir];
@@ -1663,8 +1629,8 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        cave[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
 
        o_ptr->next_o_idx = 0;
-       o_ptr->iy = (byte)p_ptr->y;
-       o_ptr->ix = (byte)p_ptr->x;
+       o_ptr->iy = p_ptr->y;
+       o_ptr->ix = p_ptr->x;
 
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
        msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
@@ -1723,7 +1689,6 @@ bool warding_glyph(void)
        cave[p_ptr->y][p_ptr->x].mimic = feat_glyph;
 
        note_spot(p_ptr->y, p_ptr->x);
-
        lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
@@ -1749,9 +1714,7 @@ bool place_mirror(void)
        cave[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
 
        note_spot(p_ptr->y, p_ptr->x);
-
        lite_spot(p_ptr->y, p_ptr->x);
-
        update_local_illumination(p_ptr->y, p_ptr->x);
 
        return TRUE;
@@ -1775,8 +1738,7 @@ bool explosive_rune(void)
        cave[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
        cave[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
 
-       note_spot(p_ptr->y, p_ptr->x);
-       
+       note_spot(p_ptr->y, p_ptr->x);  
        lite_spot(p_ptr->y, p_ptr->x);
 
        return TRUE;
@@ -1801,7 +1763,6 @@ void identify_pack(void)
                /* Skip non-objects */
                if (!o_ptr->k_idx) continue;
 
-               /* Identify it */
                identify_item(o_ptr);
 
                /* Auto-inscription */
@@ -1924,7 +1885,7 @@ bool alchemy(void)
        PRICE price;
        bool force = FALSE;
        object_type *o_ptr;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        char out_val[MAX_NLEN+40];
 
        cptr q, s;
@@ -1935,20 +1896,8 @@ bool alchemy(void)
        q = _("どのアイテムを金に変えますか?", "Turn which item to gold? ");
        s = _("金に変えられる物がありません。", "You have nothing to turn to gold.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return (FALSE);
 
        /* See how many items */
        if (o_ptr->number > 1)
@@ -1960,7 +1909,6 @@ bool alchemy(void)
                if (amt <= 0) return FALSE;
        }
 
-
        old_number = o_ptr->number;
        o_ptr->number = amt;
        object_desc(o_name, o_ptr, 0);
@@ -2077,7 +2025,6 @@ bool enchant(object_type *o_ptr, int n, int eflag)
        bool    a = object_is_artifact(o_ptr);
        bool    force = (eflag & ENCH_FORCE);
 
-
        /* Large piles resist enchantment */
        prob = o_ptr->number * 100;
 
@@ -2153,12 +2100,8 @@ bool enchant(object_type *o_ptr, int n, int eflag)
        /* Failure */
        if (!res) return (FALSE);
 
-       /* Recalculate bonuses */
-       p_ptr->update |= (PU_BONUS);
-
        /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
+       p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        calc_android_exp();
@@ -2184,13 +2127,11 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
        OBJECT_IDX item;
        bool        okay = FALSE;
        object_type *o_ptr;
-       char        o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        cptr        q, s;
 
-
        /* Assume enchant weapon */
        item_tester_hook = object_allow_enchant_weapon;
-       item_tester_no_ryoute = TRUE;
 
        /* Enchant armor if requested */
        if (num_ac) item_tester_hook = object_is_armour;
@@ -2198,19 +2139,8 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
        q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
        s = _("強化できるアイテムがない。", "You have nothing to enchant.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 #ifdef JP
@@ -2248,13 +2178,10 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
 bool artifact_scroll(void)
 {
        OBJECT_IDX item;
-       bool            okay = FALSE;
-       object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
-       cptr            q, s;
-
-
-       item_tester_no_ryoute = TRUE;
+       bool okay = FALSE;
+       object_type *o_ptr;
+       GAME_TEXT o_name[MAX_NLEN];
+       cptr q, s;
 
        /* Enchant weapon/armour */
        item_tester_hook = item_tester_hook_nameless_weapon_armour;
@@ -2262,18 +2189,8 @@ bool artifact_scroll(void)
        q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
        s = _("強化できるアイテムがない。", "You have nothing to enchant.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 #ifdef JP
@@ -2311,8 +2228,7 @@ bool artifact_scroll(void)
 #ifdef JP
                msg_format("%sは既に強化されています!", o_name );
 #else
-               msg_format("The %s %s already %s!",
-                   o_name, ((o_ptr->number > 1) ? "are" : "is"),
+               msg_format("The %s %s already %s!", o_name, ((o_ptr->number > 1) ? "are" : "is"),
                    ((o_ptr->number > 1) ? "customized items" : "a customized item"));
 #endif
        }
@@ -2321,21 +2237,20 @@ bool artifact_scroll(void)
        {
                if (o_ptr->number > 1)
                {
+                       msg_print(_("複数のアイテムに魔法をかけるだけのエネルギーはありません!", "Not enough energy to enchant more than one object!"));
 #ifdef JP
-                       msg_print("複数のアイテムに魔法をかけるだけのエネルギーはありません!");
                        msg_format("%d 個の%sが壊れた!",(o_ptr->number)-1, o_name);
 #else
-                       msg_print("Not enough enough energy to enchant more than one object!");
                        msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
 #endif
 
                        if (item >= 0)
                        {
-                               inven_item_increase(item, 1-(o_ptr->number));
+                               inven_item_increase(item, 1 - (o_ptr->number));
                        }
                        else
                        {
-                               floor_item_increase(0-item, 1-(o_ptr->number));
+                               floor_item_increase(0 - item, 1 - (o_ptr->number));
                        }
                }
                okay = create_artifact(o_ptr, TRUE);
@@ -2374,7 +2289,7 @@ bool artifact_scroll(void)
 bool identify_item(object_type *o_ptr)
 {
        bool old_known = FALSE;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        object_desc(o_name, o_ptr, 0);
 
@@ -2394,12 +2309,7 @@ bool identify_item(object_type *o_ptr)
        /* Player touches it */
        o_ptr->marked |= OM_TOUCHED;
 
-       /* Recalculate bonuses */
-       p_ptr->update |= (PU_BONUS);
-
-       /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
+       p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        strcpy(record_o_name, o_name);
@@ -2428,12 +2338,10 @@ bool ident_spell(bool only_equip)
 {
        OBJECT_IDX item;
        object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        cptr            q, s;
        bool old_known;
 
-       item_tester_no_ryoute = TRUE;
-
        if (only_equip)
                item_tester_hook = item_tester_hook_identify_weapon_armour;
        else
@@ -2455,21 +2363,9 @@ bool ident_spell(bool only_equip)
 
        s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
-       /* Identify it */
        old_known = identify_item(o_ptr);
 
        object_desc(o_name, o_ptr, 0);
@@ -2513,32 +2409,20 @@ bool mundane_spell(bool only_equip)
        cptr            q, s;
 
        if (only_equip) item_tester_hook = object_is_weapon_armour_ammo;
-       item_tester_no_ryoute = TRUE;
 
        q = _("どれを使いますか?", "Use which item? ");
        s = _("使えるものがありません。", "You have nothing you can use.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
        msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
        {
                POSITION iy = o_ptr->iy;                 /* Y-position on map, or zero */
                POSITION ix = o_ptr->ix;                 /* X-position on map, or zero */
-               s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
+               OBJECT_IDX next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
                byte marked = o_ptr->marked;         /* Object is marked */
-               s16b weight = o_ptr->number * o_ptr->weight;
+               WEIGHT weight = o_ptr->number * o_ptr->weight;
                u16b inscription = o_ptr->inscription;
 
                /* Wipe it clean */
@@ -2569,12 +2453,11 @@ bool mundane_spell(bool only_equip)
 bool identify_fully(bool only_equip)
 {
        OBJECT_IDX item;
-       object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
-       cptr            q, s;
+       object_type *o_ptr;
+       GAME_TEXT o_name[MAX_NLEN];
+       cptr q, s;
        bool old_known;
 
-       item_tester_no_ryoute = TRUE;
        if (only_equip)
                item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
        else
@@ -2596,21 +2479,9 @@ bool identify_fully(bool only_equip)
 
        s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return (FALSE);
 
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
-
-       /* Identify it */
        old_known = identify_item(o_ptr);
 
        /* Mark the item as fully known */
@@ -2677,7 +2548,7 @@ bool recharge(int power)
        byte fail_type = 1;
 
        cptr q, s;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Only accept legal items */
        item_tester_hook = item_tester_hook_recharge;
@@ -2685,19 +2556,8 @@ bool recharge(int power)
        q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
        s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE);
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return (FALSE);
 
        /* Get the object kind. */
        k_ptr = &k_info[o_ptr->k_idx];
@@ -2940,8 +2800,7 @@ bool recharge(int power)
        }
 
        /* Combine / Reorder the pack (later) */
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-
+       p_ptr->update |= (PU_COMBINE | PU_REORDER);
        p_ptr->window |= (PW_INVEN);
 
        /* Something was done */
@@ -2957,12 +2816,10 @@ bool recharge(int power)
 bool bless_weapon(void)
 {
        OBJECT_IDX item;
-       object_type     *o_ptr;
+       object_type *o_ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
-       char            o_name[MAX_NLEN];
-       cptr            q, s;
-
-       item_tester_no_ryoute = TRUE;
+       GAME_TEXT o_name[MAX_NLEN];
+       cptr q, s;
 
        /* Bless only weapons */
        item_tester_hook = object_is_weapon;
@@ -2970,20 +2827,8 @@ bool bless_weapon(void)
        q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
        s = _("祝福できる武器がありません。", "You have weapon to bless.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
-               return FALSE;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return FALSE;
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
@@ -3037,8 +2882,7 @@ bool bless_weapon(void)
        if (have_flag(flgs, TR_BLESSED))
        {
 #ifdef JP
-msg_format("%s は既に祝福されている。",
-    o_name    );
+               msg_format("%s は既に祝福されている。", o_name);
 #else
                msg_format("%s %s %s blessed already.",
                    ((item >= 0) ? "Your" : "The"), o_name,
@@ -3098,22 +2942,17 @@ msg_format("%s は既に祝福されている。",
                        msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air..."));
 
 #ifdef JP
-msg_format("%s は劣化した!",
-     o_name    );
+                       msg_format("%s は劣化した!", o_name);
 #else
-                       msg_format("%s %s %s disenchanted!",
-                           ((item >= 0) ? "Your" : "The"), o_name,
-                           ((o_ptr->number > 1) ? "were" : "was"));
+                       msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name,
+                               ((o_ptr->number > 1) ? "were" : "was"));
 #endif
 
                }
        }
 
-       /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
        p_ptr->window |= (PW_EQUIP | PW_PLAYER);
-
        calc_android_exp();
 
        return TRUE;
@@ -3130,30 +2969,17 @@ bool pulish_shield(void)
        OBJECT_IDX item;
        object_type     *o_ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
-       char            o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        cptr            q, s;
 
-       item_tester_no_ryoute = TRUE;
        /* Assume enchant weapon */
        item_tester_tval = TV_SHIELD;
 
        q = _("どの盾を磨きますか?", "Pulish which weapon? ");
        s = _("磨く盾がありません。", "You have weapon to pulish.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR)))
-               return FALSE;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return FALSE;
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
@@ -3371,7 +3197,7 @@ void display_spell_list(void)
        TERM_LEN y, x;
        int m[9];
        const magic_type *s_ptr;
-       char name[80];
+       GAME_TEXT name[MAX_NLEN];
        char out_val[160];
 
 
@@ -4018,29 +3844,17 @@ bool rustproof(void)
 {
        OBJECT_IDX item;
        object_type *o_ptr;
-       char        o_name[MAX_NLEN];
-       cptr        q, s;
+       GAME_TEXT o_name[MAX_NLEN];
+       cptr q, s;
 
-       item_tester_no_ryoute = TRUE;
        /* Select a piece of armour */
        item_tester_hook = object_is_armour;
 
        q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
        s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
 
-       if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return FALSE;
-
-       /* Get the item (in the pack) */
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-
-       /* Get the item (on the floor) */
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       if (!o_ptr) return FALSE;
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
@@ -4078,7 +3892,7 @@ bool curse_armor(void)
        int i;
        object_type *o_ptr;
 
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
 
        /* Curse the body armor */
@@ -4127,8 +3941,6 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し
 
                /* Break it */
                o_ptr->ident |= (IDENT_BROKEN);
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
                /* Recalculate mana */
@@ -4150,7 +3962,7 @@ msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返し
 bool curse_weapon_object(bool force, object_type *o_ptr)
 {
        int i;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Nothing to curse */
        if (!o_ptr->k_idx) return (FALSE);
@@ -4193,8 +4005,6 @@ bool curse_weapon_object(bool force, object_type *o_ptr)
 
                /* Break it */
                o_ptr->ident |= (IDENT_BROKEN);
-
-               /* Recalculate bonuses */
                p_ptr->update |= (PU_BONUS);
 
                /* Recalculate mana */
@@ -4272,7 +4082,7 @@ bool brand_bolts(void)
  * @details
  * Note that this function is one of the more "dangerous" ones...
  */
-static IDX poly_r_idx(MONRACE_IDX r_idx)
+static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -4506,23 +4316,15 @@ bool eat_magic(int power)
        byte fail_type = 1;
 
        cptr q, s;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        item_tester_hook = item_tester_hook_recharge;
 
        q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
        s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
 
-       if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return FALSE;
-
-       if (item >= 0)
-       {
-               o_ptr = &inventory[item];
-       }
-       else
-       {
-               o_ptr = &o_list[0 - item];
-       }
+       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
+       if (!o_ptr) return FALSE;
 
        k_ptr = &k_info[o_ptr->k_idx];
        lev = k_info[o_ptr->k_idx].level;
@@ -4758,127 +4560,12 @@ bool eat_magic(int power)
        /* Redraw mana and hp */
        p_ptr->redraw |= (PR_MANA);
 
-       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+       p_ptr->update |= (PU_COMBINE | PU_REORDER);
        p_ptr->window |= (PW_INVEN);
 
        return TRUE;
 }
 
-/*!
- * @brief 同族召喚(援軍)処理
- * @param level 召喚基準レベル
- * @param y 召喚先Y座標
- * @param x 召喚先X座標
- * @param mode 召喚オプション
- * @return ターンを消費した場合TRUEを返す
- */
-bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
-{
-       bool pet = (bool)(mode & PM_FORCE_PET);
-       if (!pet) mode |= PM_NO_PET;
-
-       switch (p_ptr->mimic_form)
-       {
-       case MIMIC_NONE:
-               switch (p_ptr->prace)
-               {
-                       case RACE_HUMAN:
-                       case RACE_AMBERITE:
-                       case RACE_BARBARIAN:
-                       case RACE_BEASTMAN:
-                       case RACE_DUNADAN:
-                               summon_kin_type = 'p';
-                               break;
-                       case RACE_HALF_ELF:
-                       case RACE_ELF:
-                       case RACE_HOBBIT:
-                       case RACE_GNOME:
-                       case RACE_DWARF:
-                       case RACE_HIGH_ELF:
-                       case RACE_NIBELUNG:
-                       case RACE_DARK_ELF:
-                       case RACE_MIND_FLAYER:
-                       case RACE_KUTAR:
-                       case RACE_S_FAIRY:
-                               summon_kin_type = 'h';
-                               break;
-                       case RACE_HALF_ORC:
-                               summon_kin_type = 'o';
-                               break;
-                       case RACE_HALF_TROLL:
-                               summon_kin_type = 'T';
-                               break;
-                       case RACE_HALF_OGRE:
-                               summon_kin_type = 'O';
-                               break;
-                       case RACE_HALF_GIANT:
-                       case RACE_HALF_TITAN:
-                       case RACE_CYCLOPS:
-                               summon_kin_type = 'P';
-                               break;
-                       case RACE_YEEK:
-                               summon_kin_type = 'y';
-                               break;
-                       case RACE_KLACKON:
-                               summon_kin_type = 'K';
-                               break;
-                       case RACE_KOBOLD:
-                               summon_kin_type = 'k';
-                               break;
-                       case RACE_IMP:
-                               if (one_in_(13)) summon_kin_type = 'U';
-                               else summon_kin_type = 'u';
-                               break;
-                       case RACE_DRACONIAN:
-                               summon_kin_type = 'd';
-                               break;
-                       case RACE_GOLEM:
-                       case RACE_ANDROID:
-                               summon_kin_type = 'g';
-                               break;
-                       case RACE_SKELETON:
-                               if (one_in_(13)) summon_kin_type = 'L';
-                               else summon_kin_type = 's';
-                               break;
-                       case RACE_ZOMBIE:
-                               summon_kin_type = 'z';
-                               break;
-                       case RACE_VAMPIRE:
-                               summon_kin_type = 'V';
-                               break;
-                       case RACE_SPECTRE:
-                               summon_kin_type = 'G';
-                               break;
-                       case RACE_SPRITE:
-                               summon_kin_type = 'I';
-                               break;
-                       case RACE_ENT:
-                               summon_kin_type = '#';
-                               break;
-                       case RACE_ANGEL:
-                               summon_kin_type = 'A';
-                               break;
-                       case RACE_DEMON:
-                               summon_kin_type = 'U';
-                               break;
-                       default:
-                               summon_kin_type = 'p';
-                               break;
-               }
-               break;
-       case MIMIC_DEMON:
-               if (one_in_(13)) summon_kin_type = 'U';
-               else summon_kin_type = 'u';
-               break;
-       case MIMIC_DEMON_LORD:
-               summon_kin_type = 'U';
-               break;
-       case MIMIC_VAMPIRE:
-               summon_kin_type = 'V';
-               break;
-       }       
-       return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
-}
 
 /*!
  * @brief 皆殺し(全方向攻撃)処理
@@ -4994,7 +4681,7 @@ bool shock_power(void)
                MONSTER_IDX m_idx = cave[y][x].m_idx;
                monster_type *m_ptr = &m_list[m_idx];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-               char m_name[80];
+               GAME_TEXT m_name[MAX_NLEN];
 
                monster_desc(m_name, m_ptr, 0);