}
+bool select_ring_slot = FALSE;
+
/*
* Wield or wear a single item from the pack or floor
*/
/* 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;
}
}
+/* See cmd5.c */
+extern bool select_ring_slot;
+
+
+static bool is_ring_slot(int i)
+{
+ return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
+}
+
+
/*
* Convert a label into the index of a item in the "equip"
* Return "-1" if the label does not indicate a real item
/* Verify the index */
if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
+ if (select_ring_slot) return is_ring_slot(i) ? i : -1;
+
/* Empty slots can never be chosen */
if (!inventory[i].k_idx) return (-1);
tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
/* Is this item "acceptable"? */
- if (item_tester_okay(o_ptr))
+ if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
{
/* Prepare an "index" */
tmp_val[0] = index_to_label(i);
o_ptr = &inventory[i];
/* Is this item acceptable? */
- if (!item_tester_okay(o_ptr) &&
+ if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
(!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
item_tester_no_ryoute)) continue;
/* Illegal items */
if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
+ if (select_ring_slot) return is_ring_slot(i);
+
/* Verify the item */
if (!item_tester_okay(&inventory[i])) return (FALSE);
else if (use_menu)
{
for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
- if (item_tester_okay(&inventory[j])) max_equip++;
+ if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
}
else if (use_menu)
{
for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
- if (item_tester_okay(&inventory[j])) max_equip++;
+ if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
}