/* File: object1.c */
-/* Purpose: Object code, part 1 */
-
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Object code, part 1 */
+
#include "angband.h"
#ifdef MACINTOSH
for (i = 0; i < TR_FLAG_SIZE; i++)
flgs[i] |= o_ptr->art_flags[i];
- if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
+ if (item_tester_hook_smith(o_ptr))
{
int add = o_ptr->xtra3 - 1;
flgs[i] |= o_ptr->art_flags[i];
}
- if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
+ if (item_tester_hook_smith(o_ptr))
{
int add = o_ptr->xtra3 - 1;
#endif
}
case ART_NIGHT:
+ case ART_HELL:
{
#ifdef JP
return "°Å¹õ¤ÎÍò(250) : 150+d150 ¥¿¡¼¥óËè";
#endif
}
+ case ART_SACRED_KNIGHTS:
+ {
+#ifdef JP
+return "*²ò¼ö*¤ÈÄ´ºº: ¤¤¤Ä¤Ç¤â";
+#else
+ return "Dispel Curse and Probing every turn";
+#endif
+
+ }
+ case ART_CHARMED:
+ {
+#ifdef JP
+return "ËâÎϤÎÍò(200) : 150+d150 ¥¿¡¼¥óËè";
+#else
+ return "mana storm (200) every 150+d150 turns";
+#endif
+
+ }
}
}
- if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
+ if (item_tester_hook_smith(o_ptr))
{
switch (o_ptr->xtra3 - 1)
{
#else
return "resist acid every 50+d50 turns";
#endif
- break;
case ESSENCE_TMP_RES_ELEC:
#ifdef JP
#else
return "resist elec every 50+d50 turns";
#endif
- break;
case ESSENCE_TMP_RES_FIRE:
#ifdef JP
#else
return "resist fire every 50+d50 turns";
#endif
- break;
case ESSENCE_TMP_RES_COLD:
#ifdef JP
#else
return "resist cold every 50+d50 turns";
#endif
- break;
case TR_IMPACT:
#ifdef JP
#else
return "earthquake every 100+d100 turns";
#endif
- break;
}
}
{
case EGO_AMU_IDENT:
#ifdef JP
-return "´ÕÄê : 10 ¥¿¡¼¥óËè";
+ return "´ÕÄê : 10 ¥¿¡¼¥óËè";
#else
return "identify every 10 turns";
#endif
- break;
case EGO_AMU_CHARM:
#ifdef JP
-return "¥â¥ó¥¹¥¿¡¼Ì¥Î» : 200 ¥¿¡¼¥óËè";
+ return "¥â¥ó¥¹¥¿¡¼Ì¥Î» : 200 ¥¿¡¼¥óËè";
#else
return "charm monster every 200 turns";
#endif
- break;
case EGO_AMU_JUMP:
#ifdef JP
-return "¥·¥ç¡¼¥È¡¦¥Æ¥ì¥Ý¡¼¥È : 10+d10 ¥¿¡¼¥óËè";
+ return "¥·¥ç¡¼¥È¡¦¥Æ¥ì¥Ý¡¼¥È : 10+d10 ¥¿¡¼¥óËè";
#else
return "blink every 10+d10 turns";
#endif
- break;
case EGO_AMU_TELEPORT:
#ifdef JP
-return "¥Æ¥ì¥Ý¡¼¥È : 50+d50 ¥¿¡¼¥óËè";
+ return "¥Æ¥ì¥Ý¡¼¥È : 50+d50 ¥¿¡¼¥óËè";
#else
return "teleport every 50+d50 turns";
#endif
- break;
case EGO_AMU_D_DOOR:
#ifdef JP
-return "¼¡¸µ¤ÎÈâ : 200 ¥¿¡¼¥óËè";
+ return "¼¡¸µ¤ÎÈâ : 200 ¥¿¡¼¥óËè";
#else
return "dimension door every 200 turns";
#endif
- break;
case EGO_AMU_RES_FIRE_:
#ifdef JP
-return "²Ð±ê¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
+ return "²Ð±ê¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
#else
return "resist fire every 50+d50 turns";
#endif
- break;
case EGO_AMU_RES_COLD_:
#ifdef JP
-return "Î䵤¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
+ return "Î䵤¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
#else
return "resist cold every 50+d50 turns";
#endif
- break;
case EGO_AMU_RES_ELEC_:
#ifdef JP
-return "ÅÅ·â¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
+ return "ÅÅ·â¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
#else
return "resist elec every 50+d50 turns";
#endif
- break;
case EGO_AMU_RES_ACID_:
#ifdef JP
-return "»À¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
+ return "»À¤Ø¤ÎÂÑÀ : 50+d50¥¿¡¼¥óËè";
#else
return "resist acid every 50+d50 turns";
#endif
- break;
case EGO_AMU_DETECTION:
#ifdef JP
-return "Á´´¶ÃÎ : 55+d55¥¿¡¼¥óËè";
+ return "Á´´¶ÃÎ : 55+d55¥¿¡¼¥óËè";
#else
return "detect all floor every 55+d55 turns";
#endif
- break;
}
}
}
byte attr = TERM_WHITE;
char tmp_val[80];
char o_name[MAX_NLEN];
+ int wid, hgt;
+ /* Get size */
+ Term_get_size(&wid, &hgt);
/* Find the "final" slot */
for (i = 0; i < INVEN_PACK; i++)
sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
#endif
- Term_putstr(71, i, -1, TERM_WHITE, tmp_val);
+ prt(tmp_val, i, wid - 9);
}
}
/* Erase the rest of the window */
- for (i = z; i < Term->hgt; i++)
+ for (i = z; i < hgt; i++)
{
/* Erase the line */
Term_erase(0, i, 255);
byte attr = TERM_WHITE;
char tmp_val[80];
char o_name[MAX_NLEN];
+ int wid, hgt;
+ /* Get size */
+ Term_get_size(&wid, &hgt);
/* Display the equipment */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
/* Erase the rest of the line */
Term_erase(3+n, i - INVEN_RARM, 255);
- /* Display the slot description (if needed) */
- if (show_labels)
- {
- Term_putstr(61, i - INVEN_RARM, -1, TERM_WHITE, "<--");
- Term_putstr(65, i - INVEN_RARM, -1, TERM_WHITE, mention_use(i));
- }
-
/* Display the weight (if needed) */
if (show_weights && o_ptr->weight)
{
int wgt = o_ptr->weight * o_ptr->number;
- int col = (show_labels ? 52 : 71);
#ifdef JP
sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
#else
sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
#endif
- Term_putstr(col, i - INVEN_RARM, -1, TERM_WHITE, tmp_val);
+ prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
+ }
+
+ /* Display the slot description (if needed) */
+ if (show_labels)
+ {
+ Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
+ prt(mention_use(i), i - INVEN_RARM, wid - 15);
}
}
/* Erase the rest of the window */
- for (i = INVEN_TOTAL - INVEN_RARM; i < Term->hgt; i++)
+ for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
{
/* Clear that line */
Term_erase(0, i, 255);
}
+/*
+ * Find the "first" inventory object with the given "tag".
+ *
+ * A "tag" is a numeral "n" appearing as "@n" anywhere in the
+ * inscription of an object. Alphabetical characters don't work as a
+ * tag in this form.
+ *
+ * Also, the tag "@xn" will work as well, where "n" is a any tag-char,
+ * and "x" is the "current" command_cmd code.
+ */
+static bool get_tag(int *cp, char tag, int mode)
+{
+ int i, start, end;
+ cptr s;
+
+ /* Extract index from mode */
+ switch (mode)
+ {
+ case USE_EQUIP:
+ start = INVEN_RARM;
+ end = INVEN_TOTAL - 1;
+ break;
+
+ case USE_INVEN:
+ start = 0;
+ end = INVEN_PACK - 1;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
+
+ /* Check every inventory object */
+ for (i = start; i <= end; i++)
+ {
+ object_type *o_ptr = &inventory[i];
+
+ /* Skip non-objects */
+ if (!o_ptr->k_idx) continue;
+
+ /* Skip empty inscriptions */
+ if (!o_ptr->inscription) continue;
+
+ /* Skip non-choice */
+ if (!item_tester_okay(o_ptr)) continue;
+
+ /* Find a '@' */
+ s = strchr(quark_str(o_ptr->inscription), '@');
+
+ /* Process all tags */
+ while (s)
+ {
+ /* Check the special tags */
+ if ((s[1] == command_cmd) && (s[2] == tag))
+ {
+ /* Save the actual inventory ID */
+ *cp = i;
+
+ /* Success */
+ return (TRUE);
+ }
+
+ /* Find another '@' */
+ s = strchr(s + 1, '@');
+ }
+ }
+
+
+ /**** Find a tag in the form of {@#} (allows only numerals) ***/
+
+ /* Don't allow {@#} with '#' being alphabet */
+ if (tag < '0' || '9' < tag)
+ {
+ /* No such tag */
+ return FALSE;
+ }
+
+ /* Check every object */
+ for (i = start; i <= end; i++)
+ {
+ object_type *o_ptr = &inventory[i];
+
+ /* Skip non-objects */
+ if (!o_ptr->k_idx) continue;
+
+ /* Skip empty inscriptions */
+ if (!o_ptr->inscription) continue;
+
+ /* Skip non-choice */
+ if (!item_tester_okay(o_ptr)) continue;
+
+ /* Find a '@' */
+ s = strchr(quark_str(o_ptr->inscription), '@');
+
+ /* Process all tags */
+ while (s)
+ {
+ /* Check the normal tags */
+ if (s[1] == tag)
+ {
+ /* Save the actual inventory ID */
+ *cp = i;
+
+ /* Success */
+ return (TRUE);
+ }
+
+ /* Find another '@' */
+ s = strchr(s + 1, '@');
+ }
+ }
+
+ /* No such tag */
+ return (FALSE);
+}
+
+
+/*
+ * Find the "first" floor object with the given "tag".
+ *
+ * A "tag" is a numeral "n" appearing as "@n" anywhere in the
+ * inscription of an object. Alphabetical characters don't work as a
+ * tag in this form.
+ *
+ * Also, the tag "@xn" will work as well, where "n" is a any tag-char,
+ * and "x" is the "current" command_cmd code.
+ */
+static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
+{
+ int i;
+ cptr s;
+
+ /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
+
+ /* Check every object in the grid */
+ for (i = 0; i < floor_num && i < 23; i++)
+ {
+ object_type *o_ptr = &o_list[floor_list[i]];
+
+ /* Skip empty inscriptions */
+ if (!o_ptr->inscription) continue;
+
+ /* Find a '@' */
+ s = strchr(quark_str(o_ptr->inscription), '@');
+
+ /* Process all tags */
+ while (s)
+ {
+ /* Check the special tags */
+ if ((s[1] == command_cmd) && (s[2] == tag))
+ {
+ /* Save the actual floor object ID */
+ *cp = i;
+
+ /* Success */
+ return (TRUE);
+ }
+
+ /* Find another '@' */
+ s = strchr(s + 1, '@');
+ }
+ }
+
+
+ /**** Find a tag in the form of {@#} (allows only numerals) ***/
+
+ /* Don't allow {@#} with '#' being alphabet */
+ if (tag < '0' || '9' < tag)
+ {
+ /* No such tag */
+ return FALSE;
+ }
+
+ /* Check every object in the grid */
+ for (i = 0; i < floor_num && i < 23; i++)
+ {
+ object_type *o_ptr = &o_list[floor_list[i]];
+
+ /* Skip empty inscriptions */
+ if (!o_ptr->inscription) continue;
+
+ /* Find a '@' */
+ s = strchr(quark_str(o_ptr->inscription), '@');
+
+ /* Process all tags */
+ while (s)
+ {
+ /* Check the normal tags */
+ if (s[1] == tag)
+ {
+ /* Save the floor object ID */
+ *cp = i;
+
+ /* Success */
+ return (TRUE);
+ }
+
+ /* Find another '@' */
+ s = strchr(s + 1, '@');
+ }
+ }
+
+ /* No such tag */
+ return (FALSE);
+}
+
+
+/*
+ * Move around label characters with correspond tags
+ */
+static void prepare_label_string(char *label, int mode)
+{
+ cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
+ int i;
+
+ /* Prepare normal labels */
+ strcpy(label, alphabet_chars);
+
+ /* Move each label */
+ for (i = 0; i < 52; i++)
+ {
+ int index;
+ char c = alphabet_chars[i];
+
+ /* Find a tag with this label */
+ if (get_tag(&index, c, mode))
+ {
+ /* Delete the overwritten label */
+ if (label[i] == c) label[i] = ' ';
+
+ /* Move the label to the place of corresponding tag */
+ label[index - offset] = c;
+ }
+ }
+}
+
+
+/*
+ * Move around label characters with correspond tags (floor version)
+ */
+static void prepare_label_string_floor(char *label, int floor_list[], int floor_num)
+{
+ cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ int i;
+
+ /* Prepare normal labels */
+ strcpy(label, alphabet_chars);
+
+ /* Move each label */
+ for (i = 0; i < 52; i++)
+ {
+ int index;
+ char c = alphabet_chars[i];
+ /* Find a tag with this label */
+ if (get_tag_floor(&index, c, floor_list, floor_num))
+ {
+ /* Delete the overwritten label */
+ if (label[i] == c) label[i] = ' ';
+ /* Move the label to the place of corresponding tag */
+ label[index] = c;
+ }
+ }
+}
/*
char out_desc[23][MAX_NLEN];
int target_item_label = 0;
int wid, hgt;
- char inven_spellbook_label[52+1];
-
- /* See cmd5.c */
- extern bool select_spellbook;
+ char inven_label[52 + 1];
/* Starting column */
col = command_gap;
z = i + 1;
}
- if (select_spellbook)
- {
- int index;
-
- strcpy(inven_spellbook_label, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
- for (i = 0; i < 52; i++)
- {
- char c;
- if (i < 26) c = (char)('a' + i);
- else c = (char)('A' + i - 26);
-
- if (get_tag(&index, c))
- {
- if (inven_spellbook_label[i] == c)
- inven_spellbook_label[i] = ' ';
- inven_spellbook_label[index] = c;
- }
- }
- }
+ prepare_label_string(inven_label, USE_INVEN);
/* Display the inventory */
for (k = 0, i = 0; i < z; i++)
}
else strcpy(tmp_val, " ");
}
- else if (i <= INVEN_PACK && select_spellbook)
+ else if (i <= INVEN_PACK)
{
- sprintf(tmp_val, "%c)", inven_spellbook_label[i]);
+ /* Prepare an index --(-- */
+ sprintf(tmp_val, "%c)", inven_label[i]);
}
else
{
(void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
#endif
- put_str(tmp_val, j + 1, wid - 9);
+ prt(tmp_val, j + 1, wid - 9);
}
}
char out_desc[23][MAX_NLEN];
int target_item_label = 0;
int wid, hgt;
-
+ char equip_label[52 + 1];
/* Starting column */
col = command_gap;
col = (len > wid - 4) ? 0 : (wid - len - 1);
#endif
+ prepare_label_string(equip_label, USE_EQUIP);
/* Output each entry */
for (j = 0; j < k; j++)
}
else strcpy(tmp_val, " ");
}
- else
+ else if (i >= INVEN_RARM)
+ {
+ /* Prepare an index --(-- */
+ sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
+ }
+ else /* Paranoia */
+ {
/* Prepare an index --(-- */
sprintf(tmp_val, "%c)", index_to_label(i));
+ }
/* Clear the line with the (possibly indented) index */
put_str(tmp_val, j+1, col);
(void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
#endif
- put_str(tmp_val, j+1, wid - 9);
+ prt(tmp_val, j + 1, wid - 9);
}
}
/*
- * Find the "first" inventory object with the given "tag".
- *
- * A "tag" is a char "n" appearing as "@n" anywhere in the
- * inscription of an object.
- *
- * Also, the tag "@xn" will work as well, where "n" is a tag-char,
- * and "x" is the "current" command_cmd code.
- */
-int get_tag(int *cp, char tag)
-{
- int i;
- cptr s;
-
- /* Check every object */
- for (i = 0; i < INVEN_TOTAL; ++i)
- {
- object_type *o_ptr = &inventory[i];
-
- /* Skip non-objects */
- if (!o_ptr->k_idx) continue;
-
- /* Skip empty inscriptions */
- if (!o_ptr->inscription) continue;
-
- /* Skip non-choice */
- if (!item_tester_okay(o_ptr)) continue;
-
- /* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
-
- /* Process all tags */
- while (s)
- {
- /* Check the special tags */
- if ((s[1] == command_cmd) && (s[2] == tag))
- {
- /* Save the actual inventory ID */
- *cp = i;
-
- /* Success */
- return (TRUE);
- }
-
- /* Find another '@' */
- s = strchr(s + 1, '@');
- }
- }
-
- /* Check every object */
- for (i = 0; i < INVEN_TOTAL; ++i)
- {
- object_type *o_ptr = &inventory[i];
-
- /* Skip non-objects */
- if (!o_ptr->k_idx) continue;
-
- /* Skip empty inscriptions */
- if (!o_ptr->inscription) continue;
-
- /* Skip non-choice */
- if (!item_tester_okay(o_ptr)) continue;
-
- /* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
-
- /* Process all tags */
- while (s)
- {
- /* Check the normal tags */
- if (s[1] == tag && !((s[2] >= '0' && s[2] <= '9') || (s[2] >= 'a' && s[2] <= 'z') || (s[2] >= 'A' && s[2] <= 'Z')))
- {
- /* Save the actual inventory ID */
- *cp = i;
-
- /* Success */
- return (TRUE);
- }
-
- /* Find another '@' */
- s = strchr(s + 1, '@');
- }
- }
-
- /* No such tag */
- return (FALSE);
-}
-
-/*
* Determine whether get_item() can get some item or not
* assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
*/
{
s16b this_o_idx, next_o_idx = 0;
- char n1, n2, which = ' ';
+ char which = ' ';
int j, k, i1, i2, e1, e2;
char out_val[160];
/* See cmd5.c */
- extern bool select_spellbook;
extern bool select_the_force;
int menu_line = (use_menu ? 1 : 0);
/* Get the item index */
if (repeat_pull(cp))
{
- if (*cp == 1111) { /* the_force */
+ if (*cp == INVEN_FORCE) { /* the_force */
item_tester_tval = 0;
item_tester_hook = NULL;
return (TRUE);
done = TRUE;
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
}
}
{
/* Hack -- Start on equipment if requested */
if (command_see && command_wrk && equip)
-
{
command_wrk = TRUE;
}
/* Inventory screen */
if (!command_wrk)
{
- /* Extract the legal requests */
- n1 = I2A(i1);
- n2 = I2A(i2);
-
/* Redraw if needed */
if (command_see) get_item_label = show_inven(menu_line);
}
/* Equipment screen */
else
{
- /* Extract the legal requests */
- n1 = I2A(e1 - INVEN_RARM);
- n2 = I2A(e2 - INVEN_RARM);
-
/* Redraw if needed */
if (command_see) get_item_label = show_equip(menu_line);
}
case 'w':
{
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
done = TRUE;
break;
case '7': case '8': case '9':
{
/* Look up the tag */
- if (!get_tag(&k, which))
+ if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
{
bell();
break;
#if 0
case '\n':
case '\r':
-#endif
{
/* Choose "default" inventory item */
if (!command_wrk)
done = TRUE;
break;
}
+#endif
case 'w':
{
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
done = TRUE;
break;
}
+
+ /* Fall through */
}
default:
{
int ver;
- if(select_spellbook){
- bool not_found = FALSE;
- /* Look up the tag */
- if (!get_tag(&k, which))
- {
+ bool not_found = FALSE;
+
+ /* Look up the alphabetical tag */
+ if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
+ {
not_found = TRUE;
- }
+ }
- /* Hack -- Validate the item */
- if ((k < INVEN_RARM) ? !inven : !equip)
- {
+ /* Hack -- Validate the item */
+ else if ((k < INVEN_RARM) ? !inven : !equip)
+ {
not_found = TRUE;
- }
+ }
- /* Validate the item */
- if (!get_item_okay(k))
- {
+ /* Validate the item */
+ else if (!get_item_okay(k))
+ {
not_found = TRUE;
- }
+ }
- if( !not_found ){
+ if (!not_found)
+ {
/* Accept that choice */
(*cp) = k;
item = TRUE;
done = TRUE;
break;
- }
- }
+ }
/* Extract "query" setting */
ver = isupper(which);
return num;
}
+
/*
* Display a list of the items on the floor at the given location.
*/
int floor_list[23], floor_num;
int wid, hgt;
+ char floor_label[52 + 1];
/* Get size */
Term_get_size(&wid, &hgt);
/* Scan for objects in the grid, using item_tester_okay() */
floor_num = scan_floor(floor_list, y, x, 0x01);
- /* Display the inventory */
+ /* Display the floor objects */
for (k = 0, i = 0; i < floor_num && i < 23; i++)
{
o_ptr = &o_list[floor_list[i]];
/* Find the column to start in */
col = (len > wid - 4) ? 0 : (wid - len - 1);
+ prepare_label_string_floor(floor_label, floor_list, floor_num);
+
/* Output each entry */
for (j = 0; j < k; j++)
{
else strcpy(tmp_val, " ");
}
else
+ {
/* Prepare an index --(-- */
- sprintf(tmp_val, "%c)", index_to_label(j));
+ sprintf(tmp_val, "%c)", floor_label[j]);
+ }
/* Clear the line with the (possibly indented) index */
put_str(tmp_val, j + 1, col);
sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
#endif
- put_str(tmp_val, j + 1, wid - 9);
+ prt(tmp_val, j + 1, wid - 9);
}
}
int floor_num, floor_list[23], floor_top = 0;
int min_width = 0;
- extern bool select_spellbook;
extern bool select_the_force;
int menu_line = (use_menu ? 1 : 0);
/* Get the item index */
if (repeat_pull(cp))
{
- if (*cp == 1111) { /* the_force */
+ if (*cp == INVEN_FORCE) { /* the_force */
item_tester_tval = 0;
item_tester_hook = NULL;
return (TRUE);
done = TRUE;
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
}
}
case 'w':
{
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
done = TRUE;
break;
case '4': case '5': case '6':
case '7': case '8': case '9':
{
- /* Look up the tag */
- if (!get_tag(&k, which))
+ if (command_wrk != USE_FLOOR)
{
- bell();
- break;
- }
+ /* Look up the tag */
+ if (!get_tag(&k, which, command_wrk))
+ {
+ bell();
+ break;
+ }
- /* Hack -- Validate the item */
- if ((k < INVEN_RARM) ? !inven : !equip)
- {
- bell();
- break;
- }
+ /* Hack -- Validate the item */
+ if ((k < INVEN_RARM) ? !inven : !equip)
+ {
+ bell();
+ break;
+ }
- /* Validate the item */
- if (!get_item_okay(k))
+ /* Validate the item */
+ if (!get_item_okay(k))
+ {
+ bell();
+ break;
+ }
+ }
+ else
{
- bell();
- break;
+ /* Look up the alphabetical tag */
+ if (get_tag_floor(&k, which, floor_list, floor_num))
+ {
+ /* Special index */
+ k = 0 - floor_list[k];
+ }
+ else
+ {
+ bell();
+ break;
+ }
}
/* Allow player to "refuse" certain actions */
case 'w':
{
if (select_the_force) {
- *cp = 1111;
+ *cp = INVEN_FORCE;
item = TRUE;
done = TRUE;
break;
}
+
+ /* Fall through */
}
default:
{
int ver;
- if(select_spellbook){
- bool not_found = FALSE;
- /* Look up the tag */
- if (!get_tag(&k, which))
- {
- not_found = TRUE;
- }
+ if (command_wrk != USE_FLOOR)
+ {
+ bool not_found = FALSE;
- /* Hack -- Validate the item */
- if ((k < INVEN_RARM) ? !inven : !equip)
- {
- not_found = TRUE;
- }
+ /* Look up the alphabetical tag */
+ if (!get_tag(&k, which, command_wrk))
+ {
+ not_found = TRUE;
+ }
- /* Validate the item */
- if (!get_item_okay(k))
- {
- not_found = TRUE;
- }
+ /* Hack -- Validate the item */
+ else if ((k < INVEN_RARM) ? !inven : !equip)
+ {
+ not_found = TRUE;
+ }
- if( !not_found ){
- /* Accept that choice */
- (*cp) = k;
- item = TRUE;
- done = TRUE;
- break;
- }
- }
+ /* Validate the item */
+ else if (!get_item_okay(k))
+ {
+ not_found = TRUE;
+ }
+
+ if (!not_found)
+ {
+ /* Accept that choice */
+ (*cp) = k;
+ item = TRUE;
+ done = TRUE;
+ break;
+ }
+ }
+ else
+ {
+ /* Look up the alphabetical tag */
+ if (get_tag_floor(&k, which, floor_list, floor_num))
+ {
+ /* Special index */
+ k = 0 - floor_list[k];
+
+ /* Accept that choice */
+ (*cp) = k;
+ item = TRUE;
+ done = TRUE;
+ break;
+ }
+ }
/* Extract "query" setting */
ver = isupper(which);
{
s16b this_o_idx;
- object_type *o_ptr;
-
cptr q, s;
int item;
return (FALSE);
}
- /* Access the object */
- o_ptr = &o_list[this_o_idx];
-
/* Pick up the object */
py_pickup_aux(this_o_idx);