From d8340f487f0b17aa36fe2a49444c047057bec935 Mon Sep 17 00:00:00 2001 From: nothere Date: Sat, 20 Dec 2003 16:30:42 +0000 Subject: [PATCH] =?utf8?q?=E3=81=BE=E3=81=A0=E4=B8=A1=E6=89=8B=E3=81=AB?= =?utf8?q?=E6=8C=87=E8=BC=AA=E3=81=8C=E8=A3=85=E5=82=99=E3=81=95=E3=82=8C?= =?utf8?q?=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84=E7=8A=B6=E6=85=8B=E3=81=A7?= =?utf8?q?=E3=81=82=E3=81=A3=E3=81=A6=E3=82=82=E6=8C=87=E8=BC=AA=E3=82=92?= =?utf8?q?=E8=A3=85=E5=82=99=E3=81=99=E3=82=8B=E6=89=8B=E3=82=92=E9=81=B8?= =?utf8?q?=E6=8A=9E=20=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E5=A4=89=E6=9B=B4.=20=E5=AE=9F=E8=A3=85=E3=81=AB?= =?utf8?q?=E3=81=82=E3=81=9F=E3=81=A3=E3=81=A6TOband=E3=81=AE=E3=82=AA?= =?utf8?q?=E3=82=AF=E3=83=88=E3=83=91=E3=82=B9=E3=82=92=E5=8F=82=E8=80=83?= =?utf8?q?=E3=81=AB=E3=81=97=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd3.c | 35 +++++++++++++++++++++++++++-------- src/object1.c | 22 ++++++++++++++++++---- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/cmd3.c b/src/cmd3.c index 688ebf849..d12c54b39 100644 --- a/src/cmd3.c +++ b/src/cmd3.c @@ -201,6 +201,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 */ @@ -351,23 +353,40 @@ void do_cmd_wield(void) /* 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; } diff --git a/src/object1.c b/src/object1.c index ec2911b9f..f6ffcc0b7 100644 --- a/src/object1.c +++ b/src/object1.c @@ -3964,6 +3964,16 @@ s16b label_to_inven(int c) } +/* 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 @@ -3978,6 +3988,8 @@ s16b label_to_equip(int c) /* 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); @@ -4436,7 +4448,7 @@ void display_equip(void) 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); @@ -4987,7 +4999,7 @@ int show_equip(int target_item) 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; @@ -5306,6 +5318,8 @@ static bool get_item_okay(int i) /* 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); @@ -5522,7 +5536,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode) 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++; } @@ -6557,7 +6571,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode) 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++; } -- 2.11.0