OSDN Git Service

add type casting for fprintf
[hengband/hengband.git] / src / cmd3.c
index e42620f..7c325ac 100644 (file)
@@ -46,13 +46,12 @@ void do_cmd_inven(void)
 
 #ifdef JP
        sprintf(out_val, "»ý¤Áʪ¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
-           lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
-           (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) 
-/ 2));
+           (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #else
        sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
            (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
-           (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2));
+           (p_ptr->total_weight * 100) / weight_limit());
 #endif
 
 
@@ -121,13 +120,12 @@ void do_cmd_equip(void)
        /* Build a prompt */
 #ifdef JP
        sprintf(out_val, "ÁõÈ÷¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
-           lbtokg1(p_ptr->total_weight) , lbtokg2(p_ptr->total_weight) ,
-           (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) 
-/ 2));
+           (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #else
        sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
            (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
-           (p_ptr->total_weight * 100) / ((adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2));
+           (long int)((p_ptr->total_weight * 100) / weight_limit()));
 #endif
 
 
@@ -201,6 +199,8 @@ static bool item_tester_hook_melee_weapon(object_type *o_ptr)
 }
 
 
+bool select_ring_slot = FALSE;
+
 /*
  * Wield or wear a single item from the pack or floor
  */
@@ -219,6 +219,8 @@ void do_cmd_wield(void)
 
        cptr q, s;
 
+       int need_switch_wielding = 0;
+
        if (p_ptr->special_defense & KATA_MUSOU)
        {
                set_action(ACTION_NONE);
@@ -260,6 +262,7 @@ void do_cmd_wield(void)
        case TV_CAPTURE:
        case TV_SHIELD:
        case TV_CARD:
+               /* Dual wielding */
                if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
                {
                        /* Restrict the choices */
@@ -276,27 +279,28 @@ void do_cmd_wield(void)
 #endif
 
                        if (!get_item(&slot, q, s, (USE_EQUIP))) return;
-                       if ((slot == INVEN_RARM) && !cursed_p(&inventory[INVEN_RARM]))
-                       {
-                               object_type *or_ptr = &inventory[INVEN_RARM];
-                               object_type *ol_ptr = &inventory[INVEN_LARM];
-                               object_type object_tmp;
-                               object_type *otmp_ptr = &object_tmp;
-                               char ol_name[MAX_NLEN];
+                       if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
+               }
 
-                               object_desc(ol_name, ol_ptr, FALSE, 0);
+               else if (buki_motteruka(INVEN_LARM)) slot = INVEN_RARM;
 
-                               object_copy(otmp_ptr, ol_ptr);
-                               object_copy(ol_ptr, or_ptr);
-                               object_copy(or_ptr, otmp_ptr);
+               /* Both arms are already used by non-weapon */
+               else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
+                        inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
+               {
+                       /* Restrict the choices */
+                       item_tester_hook = item_tester_hook_mochikae;
+
+                       /* Choose a hand */
 #ifdef JP
-                               msg_format("%s¤ò%s¤Ë¹½¤¨¤Ê¤ª¤·¤¿¡£", ol_name, left_hander ? "º¸¼ê" : "±¦¼ê");
+                       q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
+                       s = "¤ª¤Ã¤È¡£";
 #else
-                               msg_format("You wield %s at %s hand.", ol_name, left_hander ? "left" : "right");
+                       q = "Equip which hand? ";
+                       s = "Oops.";
 #endif
 
-                               slot = INVEN_LARM;
-                       }
+                       if (!get_item(&slot, q, s, (USE_EQUIP))) return;
                }
                break;
 
@@ -315,6 +319,15 @@ void do_cmd_wield(void)
 #endif
                }
 
+               else if (!inventory[INVEN_RARM].k_idx && buki_motteruka(INVEN_LARM))
+               {
+#ifdef JP
+                       if (!get_check("ÆóÅáή¤ÇÀ襤¤Þ¤¹¤«¡©")) slot = INVEN_LARM;
+#else
+                       if (!get_check("Dual wielding? ")) slot = INVEN_LARM;
+#endif
+               }
+
                /* Both arms are already used */
                else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
                {
@@ -331,36 +344,55 @@ void do_cmd_wield(void)
 #endif
 
                        if (!get_item(&slot, q, s, (USE_EQUIP))) return;
+                       if ((slot == INVEN_LARM) && !buki_motteruka(INVEN_RARM))
+                               need_switch_wielding = INVEN_RARM;
                }
                break;
 
        /* Rings */
        case TV_RING:
+               /* Choose a ring slot */
                if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
                {
-                       /* Restrict the choices */
-                       item_tester_tval = TV_RING;
-                       item_tester_no_ryoute = TRUE;
-
-                       /* Choose a ring from the equipment only */
 #ifdef JP
                        q = "¤É¤Á¤é¤Î»ØÎؤȼè¤êÂؤ¨¤Þ¤¹¤«?";
-                       s = "¤ª¤Ã¤È¡£";
 #else
                        q = "Replace which ring? ";
-                       s = "Oops.";
 #endif
+               }
+               else
+               {
+#ifdef JP
+                       q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
+#else
+                       q = "Equip which hand? ";
+#endif
+               }
 
-                       if (!get_item(&slot, q, s, (USE_EQUIP))) return;
+#ifdef JP
+               s = "¤ª¤Ã¤È¡£";
+#else
+               s = "Oops.";
+#endif
+
+               /* Restrict the choices */
+               select_ring_slot = TRUE;
+               item_tester_no_ryoute = TRUE;
+
+               if (!get_item(&slot, q, s, (USE_EQUIP)))
+               {
+                       select_ring_slot = FALSE;
+                       return;
                }
+               select_ring_slot = FALSE;
                break;
        }
 
        /* Prevent wielding into a cursed slot */
-       if (cursed_p(&inventory[slot]))
+       if (object_is_cursed(&inventory[slot]))
        {
                /* Describe it */
-               object_desc(o_name, &inventory[slot], FALSE, 0);
+               object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
                /* Message */
 #ifdef JP
@@ -375,13 +407,15 @@ void do_cmd_wield(void)
                return;
        }
 
-       if (cursed_p(o_ptr) && confirm_wear &&
-           (object_known_p(o_ptr) || (o_ptr->ident & IDENT_SENSE)))
+       if (confirm_wear &&
+               ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
+               ((o_ptr->ident & IDENT_SENSE) &&
+                       (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
        {
                char dummy[MAX_NLEN+80];
 
                /* Describe it */
-               object_desc(o_name, o_ptr, FALSE, 0);
+               object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
 #ifdef JP
 sprintf(dummy, "ËÜÅö¤Ë%s{¼ö¤ï¤ì¤Æ¤¤¤ë}¤ò»È¤¤¤Þ¤¹¤«¡©", o_name);
@@ -392,12 +426,12 @@ sprintf(dummy, "
                if (!get_check(dummy)) return;
        }
 
-       if ((o_ptr->name1 == ART_STONEMASK) && object_known_p(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
+       if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
        {
                char dummy[MAX_NLEN+80];
 
                /* Describe it */
-               object_desc(o_name, o_ptr, FALSE, 0);
+               object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
 #ifdef JP
 sprintf(dummy, "%s¤òÁõÈ÷¤¹¤ë¤ÈµÛ·ìµ´¤Ë¤Ê¤ê¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©", o_name);
@@ -409,6 +443,28 @@ sprintf(dummy, "%s
                if (!get_check(dummy)) return;
        }
 
+       if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
+       {
+               object_type *slot_o_ptr = &inventory[slot];
+               object_type *switch_o_ptr = &inventory[need_switch_wielding];
+               object_type object_tmp;
+               object_type *otmp_ptr = &object_tmp;
+               char switch_name[MAX_NLEN];
+
+               object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+
+               object_copy(otmp_ptr, switch_o_ptr);
+               object_copy(switch_o_ptr, slot_o_ptr);
+               object_copy(slot_o_ptr, otmp_ptr);
+#ifdef JP
+               msg_format("%s¤ò%s¤Ë¹½¤¨¤Ê¤ª¤·¤¿¡£", switch_name, (slot == INVEN_RARM) ? (left_hander ? "º¸¼ê" : "±¦¼ê") : (left_hander ? "±¦¼ê" : "º¸¼ê"));
+#else
+               msg_format("You wield %s at %s hand.", switch_name, (slot == INVEN_RARM) ? (left_hander ? "left" : "right") : (left_hander ? "right" : "left"));
+#endif
+
+               slot = need_switch_wielding;
+       }
+
        /* Check if completed a quest */
        for (i = 0; i < max_quests; i++)
        {
@@ -434,7 +490,7 @@ msg_print("
                identify_item(o_ptr);
 
                /* Auto-inscription */
-               auto_inscribe_item(item, is_autopick(o_ptr));
+               autopick_alter_item(item, FALSE);
        }
 
        /* Take a turn */
@@ -476,76 +532,76 @@ msg_print("
        /* Wear the new stuff */
        object_copy(o_ptr, q_ptr);
 
+       /* Player touches it */
+       o_ptr->marked |= OM_TOUCHED;
+
        /* Increase the weight */
        p_ptr->total_weight += q_ptr->weight;
 
        /* Increment the equip counter by hand */
        equip_cnt++;
 
+#ifdef JP
+#define STR_WIELD_RARM "%s(%c)¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿¡£"
+#define STR_WIELD_LARM "%s(%c)¤òº¸¼ê¤ËÁõÈ÷¤·¤¿¡£"
+#define STR_WIELD_ARMS "%s(%c)¤òξ¼ê¤Ç¹½¤¨¤¿¡£"
+#else
+#define STR_WIELD_RARM "You are wielding %s (%c) in your right hand."
+#define STR_WIELD_LARM "You are wielding %s (%c) in your left hand."
+#define STR_WIELD_ARMS "You are wielding %s (%c) with both hands."
+#endif
+
        /* Where is the item now */
        switch (slot)
        {
        case INVEN_RARM:
-               if ((o_ptr->tval != TV_SHIELD) && (o_ptr->tval != TV_CAPTURE) && (o_ptr->tval != TV_CARD) && (empty_hands(FALSE) & EMPTY_HAND_LARM) && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
-#ifdef JP
-                       act = "¤òξ¼ê¤Ç¹½¤¨¤¿";
-#else
-                       act = "You are wielding";
-#endif
+               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
+                       act = STR_WIELD_ARMS;
                else
-#ifdef JP
-                       act = (left_hander ? "¤òº¸¼ê¤ËÁõÈ÷¤·¤¿" : "¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿");
-#else
-                       act = "You are wielding";
-#endif
+                       act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
                break;
 
        case INVEN_LARM:
-#ifdef JP
-               act = (left_hander ? "¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿" : "¤òº¸¼ê¤ËÁõÈ÷¤·¤¿");
-#else
-               act = "You are wielding";
-#endif
+               if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
+                       act = STR_WIELD_ARMS;
+               else
+                       act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
                break;
 
        case INVEN_BOW:
 #ifdef JP
-               act = "¤ò¼Í·âÍѤËÁõÈ÷¤·¤¿";
+               act = "%s(%c)¤ò¼Í·âÍѤËÁõÈ÷¤·¤¿¡£";
 #else
-               act = "You are shooting with";
+               act = "You are shooting with %s (%c).";
 #endif
                break;
 
        case INVEN_LITE:
 #ifdef JP
-               act = "¤ò¸÷¸»¤Ë¤·¤¿";
+               act = "%s(%c)¤ò¸÷¸»¤Ë¤·¤¿¡£";
 #else
-               act = "Your light source is";
+               act = "Your light source is %s (%c).";
 #endif
                break;
 
        default:
 #ifdef JP
-               act = "¤òÁõÈ÷¤·¤¿";
+               act = "%s(%c)¤òÁõÈ÷¤·¤¿¡£";
 #else
-               act = "You are wearing";
+               act = "You are wearing %s (%c).";
 #endif
                break;
        }
 
        /* Describe the result */
-       object_desc(o_name, o_ptr, TRUE, 3);
+       object_desc(o_name, o_ptr, 0);
 
        /* Message */
-#ifdef JP
-       msg_format("%s(%c)%s¡£", o_name, index_to_label(slot), act );
-#else
-       msg_format("%s %s (%c).", act, o_name, index_to_label(slot));
-#endif
+       msg_format(act, o_name, index_to_label(slot));
 
 
        /* Cursed! */
-       if (cursed_p(o_ptr))
+       if (object_is_cursed(o_ptr))
        {
                /* Warn the player */
 #ifdef JP
@@ -561,63 +617,11 @@ msg_print("
                o_ptr->ident |= (IDENT_SENSE);
        }
 
+       /* The Stone Mask make the player turn into a vampire! */
        if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
        {
-               int h_percent;
-               if (p_ptr->prace < 32)
-               {
-                       p_ptr->old_race1 |= 1L << p_ptr->prace;
-               }
-               else
-               {
-                       p_ptr->old_race2 = 1L << (p_ptr->prace-32);
-               }
-               p_ptr->prace = RACE_VAMPIRE;
-#ifdef JP
-               msg_format("¤¢¤Ê¤¿¤ÏµÛ·ìµ´¤ËÊѲ½¤·¤¿¡ª");
-#else
-               msg_format("You polymorphed into a vampire!");
-#endif
-
-               rp_ptr = &race_info[p_ptr->prace];
-
-               /* Experience factor */
-               p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp;
-
-               /* Calculate the height/weight for males */
-               if (p_ptr->psex == SEX_MALE)
-               {
-                       p_ptr->ht = randnor(rp_ptr->m_b_ht, rp_ptr->m_m_ht);
-                       h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->m_b_ht);
-                       p_ptr->wt = randnor((int)(rp_ptr->m_b_wt) * h_percent /100
-                                           , (int)(rp_ptr->m_m_wt) * h_percent / 300 );
-               }
-
-               /* Calculate the height/weight for females */
-               else if (p_ptr->psex == SEX_FEMALE)
-               {
-                       p_ptr->ht = randnor(rp_ptr->f_b_ht, rp_ptr->f_m_ht);
-                       h_percent = (int)(p_ptr->ht) * 100 / (int)(rp_ptr->f_b_ht);
-                       p_ptr->wt = randnor((int)(rp_ptr->f_b_wt) * h_percent /100
-                                           , (int)(rp_ptr->f_m_wt) * h_percent / 300 );
-               }
-
-               check_experience();
-
-               /* Hitdice */
-               if (p_ptr->pclass == CLASS_SORCERER)
-                       p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
-               else
-                       p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
-
-               do_cmd_rerate(FALSE);
-
-               p_ptr->redraw |= (PR_BASIC);
-
-               p_ptr->update |= (PU_BONUS);
-
-               handle_stuff();
-               lite_spot(py, px);
+               /* Turn into a vampire */
+               change_race(RACE_VAMPIRE, "");
        }
 
        /* Recalculate bonuses */
@@ -640,53 +644,68 @@ msg_print("
 
 void kamaenaoshi(int item)
 {
-       object_type *o_ptr, *o2_ptr;
+       object_type *o_ptr, *new_o_ptr;
        char o_name[MAX_NLEN];
 
-       if ((item == INVEN_RARM) && buki_motteruka(INVEN_LARM))
+       if (item == INVEN_RARM)
        {
-               o_ptr = &inventory[INVEN_RARM];
-               o2_ptr = &inventory[INVEN_LARM];
-               object_copy(o_ptr, o2_ptr);
-               p_ptr->total_weight += o2_ptr->weight;
-               inven_item_increase(INVEN_LARM,-1);
-               inven_item_optimize(INVEN_LARM);
-               object_desc(o_name, o_ptr, TRUE, 3);
-               if (((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
+               if (buki_motteruka(INVEN_LARM))
+               {
+                       o_ptr = &inventory[INVEN_LARM];
+                       object_desc(o_name, o_ptr, 0);
+
+                       if (!object_is_cursed(o_ptr))
+                       {
+                               new_o_ptr = &inventory[INVEN_RARM];
+                               object_copy(new_o_ptr, o_ptr);
+                               p_ptr->total_weight += o_ptr->weight;
+                               inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
+                               inven_item_optimize(INVEN_LARM);
+                               if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
 #ifdef JP
-                       msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name );
+                                       msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
 #else
-                       msg_format("You are wielding %s with two-handed.", o_name );
+                                       msg_format("You are wielding %s with both hands.", o_name);
 #endif
-                else
+                                else
 #ifdef JP
-                       msg_format("%s¤ò%s¤Ç¹½¤¨¤¿¡£", o_name, (left_hander ? "º¸¼ê" : "±¦¼ê"));
+                                       msg_format("%s¤ò%s¤Ç¹½¤¨¤¿¡£", o_name, (left_hander ? "º¸¼ê" : "±¦¼ê"));
 #else
-                       msg_format("You are wielding %s with %s hand.", o_name, (left_hander ? "left":"right") );
+                                       msg_format("You are wielding %s in your %s hand.", o_name, (left_hander ? "left":"right"));
 #endif
+                       }
+                       else
+                       {
+                               if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
+#ifdef JP
+                                       msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
+#else
+                                       msg_format("You are wielding %s with both hands.", o_name);
+#endif
+                       }
+               }
        }
        else if (item == INVEN_LARM)
        {
+               o_ptr = &inventory[INVEN_RARM];
+               if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
+
                if (buki_motteruka(INVEN_RARM))
                {
-                       o_ptr = &inventory[INVEN_RARM];
-                       object_desc(o_name, o_ptr, TRUE, 3);
-                       if (((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
+                       if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
 #ifdef JP
-                               msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name );
+                               msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
 #else
-                               msg_format("You are wielding %s with two-handed.", o_name );
+                               msg_format("You are wielding %s with both hands.", o_name);
 #endif
                }
-               else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM))
+               else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
                {
-                       o_ptr = &inventory[INVEN_LARM];
-                       o2_ptr = &inventory[INVEN_RARM];
-                       object_copy(o_ptr, o2_ptr);
-                       p_ptr->total_weight += o2_ptr->weight;
-                       inven_item_increase(INVEN_RARM,-1);
+                       new_o_ptr = &inventory[INVEN_LARM];
+                       object_copy(new_o_ptr, o_ptr);
+                       p_ptr->total_weight += o_ptr->weight;
+                       inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
                        inven_item_optimize(INVEN_RARM);
-                       object_desc(o_name, o_ptr, TRUE, 3);
 #ifdef JP
                        msg_format("%s¤ò»ý¤ÁÂؤ¨¤¿¡£", o_name);
 #else
@@ -739,7 +758,7 @@ void do_cmd_takeoff(void)
 
 
        /* Item is cursed */
-       if (cursed_p(o_ptr))
+       if (object_is_cursed(o_ptr))
        {
                if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
                {
@@ -850,7 +869,7 @@ void do_cmd_drop(void)
 
 
        /* Hack -- Cannot remove cursed items */
-       if ((item >= INVEN_RARM) && cursed_p(o_ptr))
+       if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
        {
                /* Oops */
 #ifdef JP
@@ -882,9 +901,11 @@ void do_cmd_drop(void)
        /* Drop (some of) the item */
        inven_drop(item, amt);
 
-       if ((item == INVEN_RARM) || (item == INVEN_LARM)) kamaenaoshi(item);
-
-       if (item >= INVEN_RARM) calc_android_exp();
+       if (item >= INVEN_RARM)
+       {
+               kamaenaoshi(item);
+               calc_android_exp();
+       }
 
        p_ptr->redraw |= (PR_EQUIPPY);
 }
@@ -898,10 +919,11 @@ static bool high_level_book(object_type *o_ptr)
            (o_ptr->tval == TV_CHAOS_BOOK) ||
            (o_ptr->tval == TV_DEATH_BOOK) ||
            (o_ptr->tval == TV_TRUMP_BOOK) ||
-           (o_ptr->tval == TV_ENCHANT_BOOK) ||
+           (o_ptr->tval == TV_CRAFT_BOOK) ||
            (o_ptr->tval == TV_DAEMON_BOOK) ||
            (o_ptr->tval == TV_CRUSADE_BOOK) ||
-           (o_ptr->tval == TV_MUSIC_BOOK))
+           (o_ptr->tval == TV_MUSIC_BOOK) ||
+               (o_ptr->tval == TV_HEX_BOOK))
        {
                if (o_ptr->sval > 1)
                        return TRUE;
@@ -965,28 +987,10 @@ void do_cmd_destroy(void)
                o_ptr = &o_list[0 - item];
        }
 
-
-       /* See how many items */
-       if (o_ptr->number > 1)
-       {
-               /* Get a quantity */
-               amt = get_quantity(NULL, o_ptr->number);
-
-               /* Allow user abort */
-               if (amt <= 0) return;
-       }
-
-
-       /* Describe the object */
-       old_number = o_ptr->number;
-       o_ptr->number = amt;
-       object_desc(o_name, o_ptr, TRUE, 3);
-       o_ptr->number = old_number;
-
-       /* Verify unless quantity given */
+       /* Verify unless quantity given beforehand */
        if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
        {
-               bool okay = TRUE;
+               object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
 
                /* Make a verification */
                sprintf(out_val, 
@@ -999,9 +1003,6 @@ void do_cmd_destroy(void)
 
                msg_print(NULL);
 
-               /* Prompt */
-               prt(out_val, 0, 0);
-
                /* HACK : Add the line to message buffer */
                message_add(out_val);
                p_ptr->window |= (PW_MESSAGE);
@@ -1010,46 +1011,58 @@ void do_cmd_destroy(void)
                /* Get an acceptable answer */
                while (TRUE)
                {
-                       char i = inkey();
+                       char i;
+
+                       /* Prompt */
+                       prt(out_val, 0, 0);
+
+                       i = inkey();
+
+                       /* Erase the prompt */
+                       prt("", 0, 0);
+
 
                        if (i == 'y' || i == 'Y')
                        {
-                               okay = TRUE;
                                break;
                        }
                        if (i == ESCAPE || i == 'n' || i == 'N')
                        {
                                /* Cancel */
-                               okay = FALSE;
-                               break;
+                               return;
                        }
-                       if (i == 'a' || i == 'A')
+                       if (i == 'A')
                        {
-                               int idx;
-
                                /* Add an auto-destroy preference line */
-                               if (add_auto_register(o_ptr))
+                               if (autopick_autoregister(o_ptr))
                                {
                                        /* Auto-destroy it */
-                                       idx = is_autopick(o_ptr);
-                                       auto_destroy_item(item, idx);
+                                       autopick_alter_item(item, TRUE);
                                }
 
                                /* The object is already destroyed. */
                                return;
                        }
+               } /* while (TRUE) */
+       }
 
-                       /* Loop */
-                       continue;
-               }
-
-               /* Erase the prompt */
-               prt("", 0, 0);
+       /* See how many items */
+       if (o_ptr->number > 1)
+       {
+               /* Get a quantity */
+               amt = get_quantity(NULL, o_ptr->number);
 
-               /* Cancelled */
-               if (!okay) return;
+               /* Allow user abort */
+               if (amt <= 0) return;
        }
 
+
+       /* Describe the object */
+       old_number = o_ptr->number;
+       o_ptr->number = amt;
+       object_desc(o_name, o_ptr, 0);
+       o_ptr->number = old_number;
+
        /* Take a turn */
        energy_use = 100;
 
@@ -1217,7 +1230,7 @@ void do_cmd_observe(void)
 
 
        /* Description */
-       object_desc(o_name, o_ptr, TRUE, 3);
+       object_desc(o_name, o_ptr, 0);
 
        /* Describe */
 #ifdef JP
@@ -1228,9 +1241,9 @@ void do_cmd_observe(void)
 
        /* Describe it fully */
 #ifdef JP
-       if (!screen_object(o_ptr, TRUE)) msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
+       if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
 #else
-       if (!screen_object(o_ptr, TRUE)) msg_print("You see nothing special.");
+       if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print("You see nothing special.");
 #endif
 
 }
@@ -1348,7 +1361,7 @@ void do_cmd_inscribe(void)
        }
 
        /* Describe the activity */
-       object_desc(o_name, o_ptr, TRUE, 2);
+       object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
 
        /* Message */
 #ifdef JP
@@ -1975,6 +1988,7 @@ void do_cmd_query_symbol(void)
        bool    all = FALSE;
        bool    uniq = FALSE;
        bool    norm = FALSE;
+       bool    ride = FALSE;
        char    temp[80] = "";
 
        bool    recall = FALSE;
@@ -1984,12 +1998,11 @@ void do_cmd_query_symbol(void)
 
        /* Get a character, or abort */
 #ifdef JP
-       if (!get_com("ÃΤꤿ¤¤Ê¸»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ­¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^M̾Á°): ", &sym, FALSE)) return;
+       if (!get_com("ÃΤꤿ¤¤Ê¸»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ­¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^R¾èÇÏ,^M̾Á°): ", &sym, FALSE)) return;
 #else
        if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE)) return;
 #endif
 
-
        /* Find that character info, and describe it */
        for (i = 0; ident_info[i]; ++i)
        {
@@ -2005,7 +2018,6 @@ void do_cmd_query_symbol(void)
 #else
                strcpy(buf, "Full monster list.");
 #endif
-
        }
        else if (sym == KTRL('U'))
        {
@@ -2015,7 +2027,6 @@ void do_cmd_query_symbol(void)
 #else
                strcpy(buf, "Unique monster list.");
 #endif
-
        }
        else if (sym == KTRL('N'))
        {
@@ -2025,7 +2036,15 @@ void do_cmd_query_symbol(void)
 #else
                strcpy(buf, "Non-unique monster list.");
 #endif
-
+       }
+       else if (sym == KTRL('R'))
+       {
+               all = ride = TRUE;
+#ifdef JP
+               strcpy(buf, "¾èÇϲÄǽ¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
+#else
+               strcpy(buf, "Ridable monster list.");
+#endif
        }
        /* XTRA HACK WHATSEARCH */
        else if (sym == KTRL('M'))
@@ -2057,7 +2076,6 @@ void do_cmd_query_symbol(void)
 #else
                sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
 #endif
-
        }
 
        /* Display the result */
@@ -2080,12 +2098,17 @@ void do_cmd_query_symbol(void)
                /* Require unique monsters if needed */
                if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
 
+               /* Require ridable monsters if needed */
+               if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
+
                /* XTRA HACK WHATSEARCH */
-               if (temp[0]){
+               if (temp[0])
+               {
                  int xx;
                  char temp2[80];
   
-                 for (xx=0; temp[xx] && xx<80; xx++){
+                 for (xx=0; temp[xx] && xx<80; xx++)
+                 {
 #ifdef JP
                    if (iskanji( temp[xx])) { xx++; continue; }
 #endif
@@ -2101,14 +2124,15 @@ void do_cmd_query_symbol(void)
                    if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]);
   
 #ifdef JP
-                 if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp) )
+                 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp) )
 #else
-                 if (strstr(temp2, temp))
+                 if (my_strstr(temp2, temp))
 #endif
                          who[n++]=i;
-               }else
+               }
+
                /* Collect "appropriate" monsters */
-               if (all || (r_ptr->d_char == sym)) who[n++] = i;
+               else if (all || (r_ptr->d_char == sym)) who[n++] = i;
        }
 
        /* Nothing to recall */