4 #include "player-inventory.h"
8 #include "objectkind.h"
9 #include "object-flavor.h"
10 #include "object-hook.h"
12 #include "player-move.h"
14 #include "view-mainwindow.h"
16 bool select_ring_slot;
18 void prepare_label_string(player_type *creature_ptr, char *label, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval);
21 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
22 * @param i プレイヤーの所持/装備オブジェクトID
23 * @return 指輪枠ならばTRUEを返す。
25 bool is_ring_slot(int i)
27 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
32 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
33 * @param owner_ptr プレーヤーへの参照ポインタ
34 * Convert a label into the index of a item in the "equip"
35 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
37 static INVENTORY_IDX label_to_equipment(player_type* owner_ptr, int c)
39 INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
41 /* Verify the index */
42 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return -1;
44 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
46 /* Empty slots can never be chosen */
47 if (!owner_ptr->inventory_list[i].k_idx) return -1;
54 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
55 * Convert a label into the index of an item in the "inven"
56 * @param owner_ptr プレーヤーへの参照ポインタ
57 * @param c 選択されたアルファベット
58 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
59 * @details Note that the label does NOT distinguish inven/equip.
61 static INVENTORY_IDX label_to_inventory(player_type* owner_ptr, int c)
63 INVENTORY_IDX i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
65 /* Verify the index */
66 if ((i < 0) || (i > INVEN_PACK)) return -1;
68 /* Empty slots can never be chosen */
69 if (!owner_ptr->inventory_list[i].k_idx) return -1;
76 * @brief 所持/装備オブジェクトIDの部位表現を返す /
77 * Return a string mentioning how a given item is carried
78 * @param owner_ptr プレーヤーへの参照ポインタ
79 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
80 * @return 部位表現の文字列ポインタ
82 static concptr mention_use(player_type *owner_ptr, int i)
86 /* Examine the location */
90 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "運搬中" : ((owner_ptr->ryoute && owner_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
92 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "Just lifting" : (owner_ptr->migite ? "Wielding" : "On arm"); break;
96 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "運搬中" : ((owner_ptr->ryoute && owner_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
98 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "Just lifting" : (owner_ptr->hidarite ? "Wielding" : "On arm"); break;
101 case INVEN_BOW: p = (adj_str_hold[owner_ptr->stat_ind[A_STR]] < owner_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
102 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
103 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
104 case INVEN_NECK: p = _(" 首", "Around neck"); break;
105 case INVEN_LITE: p = _(" 光源", "Light source"); break;
106 case INVEN_BODY: p = _(" 体", "On body"); break;
107 case INVEN_OUTER: p = _("体の上", "About body"); break;
108 case INVEN_HEAD: p = _(" 頭", "On head"); break;
109 case INVEN_HANDS: p = _(" 手", "On hands"); break;
110 case INVEN_FEET: p = _(" 足", "On feet"); break;
111 default: p = _("ザック", "In pack"); break;
119 * @brief 装備アイテム一覧を表示する /
120 * Choice window "shadow" of the "show_equip()" function
123 void display_equipment(player_type *owner_ptr, OBJECT_TYPE_VALUE tval)
125 if (!owner_ptr || !owner_ptr->inventory_list) return;
128 Term_get_size(&wid, &hgt);
130 TERM_COLOR attr = TERM_WHITE;
132 GAME_TEXT o_name[MAX_NLEN];
133 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
136 o_ptr = &owner_ptr->inventory_list[i];
137 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
138 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval))
140 tmp_val[0] = index_to_label(i);
144 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
145 if ((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute)
147 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
152 object_desc(owner_ptr, o_name, o_ptr, 0);
153 attr = tval_to_attr[o_ptr->tval % 128];
156 int n = strlen(o_name);
161 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
163 Term_erase(3 + n, i - INVEN_RARM, 255);
167 int wgt = o_ptr->weight * o_ptr->number;
169 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
171 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
174 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
179 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
180 prt(mention_use(owner_ptr, i), i - INVEN_RARM, wid - 15);
184 for (int i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
186 Term_erase(0, i, 255);
192 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
193 * Flip "inven" and "equip" in any sub-windows
196 void toggle_inventory_equipment(player_type *owner_ptr)
198 for (int j = 0; j < 8; j++)
200 if (!angband_term[j]) continue;
202 /* Flip inven to equip */
203 if (window_flag[j] & (PW_INVEN))
206 window_flag[j] &= ~(PW_INVEN);
207 window_flag[j] |= (PW_EQUIP);
209 owner_ptr->window |= (PW_EQUIP);
213 /* Flip inven to equip */
214 if (window_flag[j] & PW_EQUIP)
216 window_flag[j] &= ~(PW_EQUIP);
217 window_flag[j] |= PW_INVEN;
218 owner_ptr->window |= PW_INVEN;
225 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
226 * Auxiliary function for "get_item()" -- test an index
228 * @return 正規のIDならばTRUEを返す。
230 bool get_item_okay(player_type *owner_ptr, OBJECT_IDX i)
233 if ((i < 0) || (i >= INVEN_TOTAL)) return FALSE;
235 if (select_ring_slot) return is_ring_slot(i);
237 /* Verify the item */
238 if (!item_tester_okay(owner_ptr, &owner_ptr->inventory_list[i], item_tester_tval)) return FALSE;
246 * todo この関数のプロトタイプ宣言がobject.hにいる。player_inventory.hであるべき
247 * @brief 規定の処理にできるアイテムがプレイヤーの利用可能範囲内にあるかどうかを返す /
248 * Determine whether get_item() can get some item or not
249 * @return アイテムを拾えるならばTRUEを返す。
250 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
252 bool can_get_item(player_type *owner_ptr, OBJECT_TYPE_VALUE tval)
254 for (int j = 0; j < INVEN_TOTAL; j++)
255 if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval))
258 OBJECT_IDX floor_list[23];
259 ITEM_NUMBER floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
260 return floor_num != 0;
265 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
266 * Find the "first" inventory object with the given "tag".
267 * @param cp 対応するタグIDを与える参照ポインタ
268 * @param tag 該当するオブジェクトがあるかを調べたいタグ
269 * @param floor_list 床上アイテムの配列
270 * @param floor_num 床上アイテムの配列ID
271 * @return タグに該当するオブジェクトがあるならTRUEを返す
273 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
274 * inscription of an object. Alphabetical characters don't work as a\n
275 * tag in this form.\n
277 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
278 * and "x" is the "current" command_cmd code.\n
280 static bool get_tag_floor(floor_type *floor_ptr, COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
282 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
284 /* Check every object in the grid */
285 for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++)
287 object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
289 /* Skip empty inscriptions */
290 if (!o_ptr->inscription) continue;
293 concptr s = my_strchr(quark_str(o_ptr->inscription), '@');
295 /* Process all tags */
298 /* Check the special tags */
299 if ((s[1] == command_cmd) && (s[2] == tag))
301 /* Save the actual floor object ID */
308 /* Find another '@' */
309 s = my_strchr(s + 1, '@');
314 /**** Find a tag in the form of {@#} (allows only numerals) ***/
316 /* Don't allow {@#} with '#' being alphabet */
317 if (tag < '0' || '9' < tag)
323 /* Check every object in the grid */
324 for (COMMAND_CODE i = 0; i < floor_num && i < 23; i++)
326 object_type *o_ptr = &floor_ptr->o_list[floor_list[i]];
328 /* Skip empty inscriptions */
329 if (!o_ptr->inscription) continue;
332 concptr s = my_strchr(quark_str(o_ptr->inscription), '@');
334 /* Process all tags */
337 /* Check the normal tags */
340 /* Save the floor object ID */
347 /* Find another '@' */
348 s = my_strchr(s + 1, '@');
357 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
358 * Find the "first" inventory object with the given "tag".
359 * @param owner_ptr プレーヤーへの参照ポインタ
360 * @param cp 対応するタグIDを与える参照ポインタ
361 * @param tag 該当するオブジェクトがあるかを調べたいタグ
362 * @param mode 所持、装備の切り替え
363 * @return タグに該当するオブジェクトがあるならTRUEを返す
365 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
366 * inscription of an object. Alphabetical characters don't work as a\n
367 * tag in this form.\n
369 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
370 * and "x" is the "current" command_cmd code.\n
372 static bool get_tag(player_type *owner_ptr, COMMAND_CODE *cp, char tag, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
374 /* Extract index from mode */
375 COMMAND_CODE start, end;
380 end = INVEN_TOTAL - 1;
385 end = INVEN_PACK - 1;
392 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
394 for (COMMAND_CODE i = start; i <= end; i++)
396 object_type *o_ptr = &owner_ptr->inventory_list[i];
397 if (!o_ptr->k_idx) continue;
399 /* Skip empty inscriptions */
400 if (!o_ptr->inscription) continue;
402 /* Skip non-choice */
403 if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL)) continue;
406 concptr s = my_strchr(quark_str(o_ptr->inscription), '@');
408 /* Process all tags */
411 /* Check the special tags */
412 if ((s[1] == command_cmd) && (s[2] == tag))
420 /* Find another '@' */
421 s = my_strchr(s + 1, '@');
426 /**** Find a tag in the form of {@#} (allows only numerals) ***/
428 /* Don't allow {@#} with '#' being alphabet */
429 if (tag < '0' || '9' < tag)
435 /* Check every object */
436 for (COMMAND_CODE i = start; i <= end; i++)
438 object_type *o_ptr = &owner_ptr->inventory_list[i];
439 if (!o_ptr->k_idx) continue;
441 /* Skip empty inscriptions */
442 if (!o_ptr->inscription) continue;
444 /* Skip non-choice */
445 if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL)) continue;
448 concptr s = my_strchr(quark_str(o_ptr->inscription), '@');
450 /* Process all tags */
453 /* Check the normal tags */
462 /* Find another '@' */
463 s = my_strchr(s + 1, '@');
472 * @brief タグIDにあわせてタグアルファベットのリストを返す /
473 * Move around label characters with correspond tags
474 * @param owner_ptr プレーヤーへの参照ポインタ
475 * @param label ラベルリストを取得する文字列参照ポインタ
476 * @param mode 所持品リストか装備品リストかの切り替え
479 void prepare_label_string(player_type *owner_ptr, char *label, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
481 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
482 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
484 /* Prepare normal labels */
485 strcpy(label, alphabet_chars);
487 /* Move each label */
488 for (int i = 0; i < 52; i++)
491 SYMBOL_CODE c = alphabet_chars[i];
493 /* Find a tag with this label */
494 if (!get_tag(owner_ptr, &index, c, mode, tval)) continue;
496 /* Delete the overwritten label */
497 if (label[i] == c) label[i] = ' ';
499 /* Move the label to the place of corresponding tag */
500 label[index - offset] = c;
506 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
507 * Move around label characters with correspond tags (floor version)
508 * @param label ラベルリストを取得する文字列参照ポインタ
509 * @param floor_list 床上アイテムの配列
510 * @param floor_num 床上アイテムの配列ID
515 static void prepare_label_string_floor(floor_type *floor_ptr, char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
517 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
519 /* Prepare normal labels */
520 strcpy(label, alphabet_chars);
522 /* Move each label */
523 for (int i = 0; i < 52; i++)
526 SYMBOL_CODE c = alphabet_chars[i];
528 /* Find a tag with this label */
529 if (!get_tag_floor(floor_ptr, &index, c, floor_list, floor_num)) continue;
531 /* Delete the overwritten label */
532 if (label[i] == c) label[i] = ' ';
534 /* Move the label to the place of corresponding tag */
540 * @brief 所持アイテムの表示を行う /
541 * Display the inventory.
542 * @param target_item アイテムの選択処理を行うか否か。
543 * @return 選択したアイテムのタグ
545 * Hack -- do not display "trailing" empty slots
547 COMMAND_CODE show_inventory(player_type *owner_ptr, int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
552 GAME_TEXT o_name[MAX_NLEN];
554 COMMAND_CODE out_index[23];
555 TERM_COLOR out_color[23];
556 char out_desc[23][MAX_NLEN];
557 COMMAND_CODE target_item_label = 0;
558 char inven_label[52 + 1];
560 /* Starting column */
561 int col = command_gap;
564 Term_get_size(&wid, &hgt);
566 /* Default "max-length" */
567 int len = wid - col - 1;
569 /* Find the "final" slot */
570 for (i = 0; i < INVEN_PACK; i++)
572 o_ptr = &owner_ptr->inventory_list[i];
573 if (!o_ptr->k_idx) continue;
579 prepare_label_string(owner_ptr, inven_label, USE_INVEN, tval);
581 for (k = 0, i = 0; i < z; i++)
583 o_ptr = &owner_ptr->inventory_list[i];
585 /* Is this item acceptable? */
586 if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL)) continue;
588 object_desc(owner_ptr, o_name, o_ptr, 0);
590 /* Save the object index, color, and description */
592 out_color[k] = tval_to_attr[o_ptr->tval % 128];
594 /* Grey out charging items */
597 out_color[k] = TERM_L_DARK;
600 (void)strcpy(out_desc[k], o_name);
602 /* Find the predicted "line length" */
603 l = strlen(out_desc[k]) + 5;
605 /* Be sure to account for the weight */
606 if (show_weights) l += 9;
608 /* Account for icon if displayed */
612 if (use_bigtile) l++;
615 /* Maintain the maximum length */
616 if (l > len) len = l;
618 /* Advance to next "line" */
622 /* Find the column to start in */
623 col = (len > wid - 4) ? 0 : (wid - len - 1);
625 /* Output each entry */
628 for (j = 0; j < k; j++)
631 o_ptr = &owner_ptr->inventory_list[i];
634 prt("", j + 1, col ? col - 2 : col);
636 if (use_menu && target_item)
638 if (j == (target_item - 1))
640 strcpy(tmp_val, _("》", "> "));
641 target_item_label = i;
643 else strcpy(tmp_val, " ");
645 else if (i <= INVEN_PACK)
647 /* Prepare an index --(-- */
648 sprintf(tmp_val, "%c)", inven_label[i]);
652 /* Prepare an index --(-- */
653 sprintf(tmp_val, "%c)", index_to_label(i));
656 /* Clear the line with the (possibly indented) index */
657 put_str(tmp_val, j + 1, col);
661 /* Display graphics for object, if desired */
664 TERM_COLOR a = object_attr(o_ptr);
665 SYMBOL_CODE c = object_char(o_ptr);
666 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
667 if (use_bigtile) cur_col++;
673 /* Display the entry itself */
674 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
676 /* Display the weight if needed */
679 int wgt = o_ptr->weight * o_ptr->number;
681 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
683 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
686 prt(tmp_val, j + 1, wid - 9);
690 /* Make a "shadow" below the list (only if needed) */
691 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
693 /* Save the new column */
696 return target_item_label;
701 * @brief 選択したアイテムの確認処理の補助 /
702 * Verify the choice of an item.
703 * @param owner_ptr プレーヤーへの参照ポインタ
704 * @param prompt メッセージ表示の一部
705 * @param item 選択アイテムID
706 * @return 確認がYesならTRUEを返す。
707 * @details The item can be negative to mean "item on floor".
709 static bool verify(player_type *owner_ptr, concptr prompt, INVENTORY_IDX item)
711 GAME_TEXT o_name[MAX_NLEN];
712 char out_val[MAX_NLEN + 20];
719 o_ptr = &owner_ptr->inventory_list[item];
725 o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
727 object_desc(owner_ptr, o_name, o_ptr, 0);
730 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
733 return (get_check(out_val));
738 * @brief 選択したアイテムの確認処理のメインルーチン /
739 * @param owner_ptr プレーヤーへの参照ポインタ
740 * @param item 選択アイテムID
741 * @return 確認がYesならTRUEを返す。
742 * @details The item can be negative to mean "item on floor".
743 * Hack -- allow user to "prevent" certain choices
745 static bool get_item_allow(player_type *owner_ptr, INVENTORY_IDX item)
747 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
753 o_ptr = &owner_ptr->inventory_list[item];
759 o_ptr = &owner_ptr->current_floor_ptr->o_list[0 - item];
763 if (!o_ptr->inscription) return TRUE;
766 concptr s = my_strchr(quark_str(o_ptr->inscription), '!');
768 /* Process preventions */
771 /* Check the "restriction" */
772 if ((s[1] == command_cmd) || (s[1] == '*'))
774 /* Verify the choice */
775 if (!verify(owner_ptr, _("本当に", "Really try"), item)) return FALSE;
778 /* Find another '!' */
779 s = my_strchr(s + 1, '!');
787 * @brief オブジェクト選択の汎用関数 /
788 * Let the user select an item, save its "index"
789 * @param owner_ptr プレーヤーへの参照ポインタ
790 * @param cp 選択したオブジェクトのIDを返す。
791 * @param pmt 選択目的のメッセージ
792 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
793 * @param mode オプションフラグ
794 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
795 * Return TRUE only if an acceptable item was chosen by the user.\n
797 * The selected item must satisfy the "item_tester_hook()" function,\n
798 * if that hook is set, and the "item_tester_tval", if that value is set.\n
800 * All "item_tester" restrictions are cleared before this function returns.\n
802 * The user is allowed to choose acceptable items from the equipment,\n
803 * inventory, or floor, respectively, if the proper flag was given,\n
804 * and there are any acceptable items in that location.\n
806 * The equipment or inventory are displayed (even if no acceptable\n
807 * items are in that location) if the proper flag was given.\n
809 * If there are no acceptable items available anywhere, and "str" is\n
810 * not NULL, then it will be used as the text of a warning message\n
811 * before the function returns.\n
813 * Note that the user must press "-" to specify the item on the floor,\n
814 * and there is no way to "examine" the item on the floor, while the\n
815 * use of "capital" letters will "examine" an inventory/equipment item,\n
816 * and prompt for its use.\n
818 * If a legal item is selected from the inventory, we save it in "cp"\n
819 * directly (0 to 35), and return TRUE.\n
821 * If a legal item is selected from the floor, we save it in "cp" as\n
822 * a negative (-1 to -511), and return TRUE.\n
824 * If no item is available, we do nothing to "cp", and we display a\n
825 * warning message, using "str" if available, and return FALSE.\n
827 * If no item is selected, we do nothing to "cp", and return FALSE.\n
829 * Global "command_new" is used when viewing the inventory or equipment\n
830 * to allow the user to enter a command while viewing those screens, and\n
831 * also to induce "auto-enter" of stores, and other such stuff.\n
833 * Global "command_see" may be set before calling this function to start\n
834 * out in "browse" mode. It is cleared before this function returns.\n
836 * Global "command_wrk" is used to choose between equip/inven listings.\n
837 * If it is TRUE then we are viewing inventory, else equipment.\n
839 * We always erase the prompt when we are done, leaving a blank line,\n
840 * or a warning message, if appropriate, if no items are available.\n
842 bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
844 OBJECT_IDX this_o_idx, next_o_idx = 0;
861 bool allow_floor = FALSE;
868 int menu_line = (use_menu ? 1 : 0);
872 static char prev_tag = '\0';
875 if (easy_floor || use_menu) return get_item_floor(owner_ptr, cp, pmt, str, mode, tval);
878 if (mode & USE_EQUIP) equip = TRUE;
879 if (mode & USE_INVEN) inven = TRUE;
880 if (mode & USE_FLOOR) floor = TRUE;
882 /* Get the item index */
886 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
889 item_tester_hook = NULL;
890 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
895 else if (floor && (*cp < 0))
901 o_ptr = &owner_ptr->current_floor_ptr->o_list[k];
903 /* Validate the item */
904 if (item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL))
906 /* Forget restrictions */
908 item_tester_hook = NULL;
909 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
916 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
917 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
919 if (prev_tag && command_cmd)
921 /* Look up the tag and validate the item */
922 if (!get_tag(owner_ptr, &k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
923 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
924 else if (!get_item_okay(owner_ptr, k)) /* Reject */;
927 /* Accept that choice */
930 /* Forget restrictions */
932 item_tester_hook = NULL;
933 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
939 prev_tag = '\0'; /* prev_tag is no longer effective */
942 /* Verify the item */
943 else if (get_item_okay(owner_ptr, *cp))
945 /* Forget restrictions */
947 item_tester_hook = NULL;
948 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
961 /* No item selected */
970 for (j = 0; j < INVEN_PACK; j++)
971 if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
974 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1))) i1++;
975 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2))) i2--;
980 e2 = INVEN_TOTAL - 1;
982 /* Forbid equipment */
986 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
987 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
988 if (owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
991 /* Restrict equipment indexes */
992 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1))) e1++;
993 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2))) e2--;
995 if (equip && owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
997 if (owner_ptr->migite)
999 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
1001 else if (owner_ptr->hidarite) e1 = INVEN_RARM;
1004 /* Restrict floor usage */
1007 /* Scan all objects in the grid */
1008 for (this_o_idx = owner_ptr->current_floor_ptr->grid_array[owner_ptr->y][owner_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1011 o_ptr = &owner_ptr->current_floor_ptr->o_list[this_o_idx];
1012 next_o_idx = o_ptr->next_o_idx;
1014 /* Accept the item on the floor if legal */
1015 if ((item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
1019 /* Require at least one legal choice */
1020 if (!allow_floor && (i1 > i2) && (e1 > e2))
1022 command_see = FALSE;
1026 if (mode & USE_FORCE) {
1032 /* Analyze choices */
1035 if (command_see && command_wrk && equip)
1042 command_wrk = FALSE;
1052 command_wrk = FALSE;
1058 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
1060 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
1062 /* Hack -- start out in "display" mode */
1069 /* Repeat until done */
1072 COMMAND_CODE get_item_label = 0;
1079 for (j = 0; j < 8; j++)
1082 if (!angband_term[j]) continue;
1084 /* Count windows displaying inven */
1085 if (window_flag[j] & (PW_INVEN)) ni++;
1087 /* Count windows displaying equip */
1088 if (window_flag[j] & (PW_EQUIP)) ne++;
1091 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
1093 toggle_inventory_equipment(owner_ptr);
1097 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
1098 handle_stuff(owner_ptr);
1100 /* Inventory screen */
1103 /* Redraw if needed */
1104 if (command_see) get_item_label = show_inventory(owner_ptr, menu_line, mode, tval);
1107 /* Equipment screen */
1110 /* Redraw if needed */
1111 if (command_see) get_item_label = show_equipment(owner_ptr, menu_line, mode, tval);
1116 /* Begin the prompt */
1117 sprintf(out_val, _("持ち物:", "Inven:"));
1119 /* Some legal items */
1120 if ((i1 <= i2) && !use_menu)
1122 /* Build the prompt */
1123 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1124 index_to_label(i1), index_to_label(i2));
1127 strcat(out_val, tmp_val);
1130 /* Indicate ability to "view" */
1131 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1134 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
1137 /* Viewing equipment */
1140 /* Begin the prompt */
1141 sprintf(out_val, _("装備品:", "Equip:"));
1143 /* Some legal items */
1144 if ((e1 <= e2) && !use_menu)
1146 /* Build the prompt */
1147 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1148 index_to_label(e1), index_to_label(e2));
1151 strcat(out_val, tmp_val);
1154 /* Indicate ability to "view" */
1155 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1158 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
1161 /* Indicate legality of the "floor" item */
1162 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
1163 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
1165 /* Finish the prompt */
1166 strcat(out_val, " ESC");
1168 /* Build the prompt */
1169 sprintf(tmp_val, "(%s) %s", out_val, pmt);
1171 /* Show the prompt */
1179 int max_line = (command_wrk ? max_equip : max_inven);
1195 menu_line += (max_line - 1);
1214 /* Verify legality */
1215 if (!inven || !equip)
1221 /* Hack -- Fix screen */
1228 /* Switch inven/equip */
1229 command_wrk = !command_wrk;
1230 max_line = (command_wrk ? max_equip : max_inven);
1231 if (menu_line > max_line) menu_line = max_line;
1233 /* Need to redraw */
1242 if (command_wrk == USE_FLOOR)
1245 (*cp) = -get_item_label;
1249 /* Validate the item */
1250 if (!get_item_okay(owner_ptr, get_item_label))
1256 /* Allow player to "refuse" certain actions */
1257 if (!get_item_allow(owner_ptr, get_item_label))
1263 /* Accept that choice */
1264 (*cp) = get_item_label;
1273 if (mode & USE_FORCE) {
1281 if (menu_line > max_line) menu_line -= max_line;
1302 command_see = FALSE;
1319 /* Verify legality */
1320 if (!inven || !equip)
1326 /* Hack -- Fix screen */
1333 /* Switch inven/equip */
1334 command_wrk = !command_wrk;
1336 /* Need to redraw */
1342 /* Use floor item */
1345 /* Scan all objects in the grid */
1346 for (this_o_idx = owner_ptr->current_floor_ptr->grid_array[owner_ptr->y][owner_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1349 o_ptr = &owner_ptr->current_floor_ptr->o_list[this_o_idx];
1350 next_o_idx = o_ptr->next_o_idx;
1352 /* Validate the item */
1353 if (!item_tester_okay(owner_ptr, o_ptr, tval) && !(mode & USE_FULL)) continue;
1358 /* Verify the item (if required) */
1359 if (other_query_flag && !verify(owner_ptr, _("本当に", "Try"), k)) continue;
1361 /* Allow player to "refuse" certain actions */
1362 if (!get_item_allow(owner_ptr, k)) continue;
1364 /* Accept that choice */
1380 case '1': case '2': case '3':
1381 case '4': case '5': case '6':
1382 case '7': case '8': case '9':
1384 /* Look up the tag */
1385 if (!get_tag(owner_ptr, &k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1391 /* Hack -- Validate the item */
1392 if ((k < INVEN_RARM) ? !inven : !equip)
1398 /* Validate the item */
1399 if (!get_item_okay(owner_ptr, k))
1405 /* Allow player to "refuse" certain actions */
1406 if (!get_item_allow(owner_ptr, k))
1412 /* Accept that choice */
1422 if (mode & USE_FORCE) {
1434 bool not_found = FALSE;
1436 /* Look up the alphabetical tag */
1437 if (!get_tag(owner_ptr, &k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1442 /* Hack -- Validate the item */
1443 else if ((k < INVEN_RARM) ? !inven : !equip)
1448 /* Validate the item */
1449 else if (!get_item_okay(owner_ptr, k))
1456 /* Accept that choice */
1464 /* Extract "query" setting */
1465 ver = isupper(which);
1466 which = (char)tolower(which);
1470 if (which == '(') k = i1;
1471 else if (which == ')') k = i2;
1472 else k = label_to_inventory(owner_ptr, which);
1475 /* Convert letter to equipment index */
1478 if (which == '(') k = e1;
1479 else if (which == ')') k = e2;
1480 else k = label_to_equipment(owner_ptr, which);
1483 /* Validate the item */
1484 if (!get_item_okay(owner_ptr, k))
1490 /* Verify the item */
1491 if (ver && !verify(owner_ptr, _("本当に", "Try"), k))
1497 /* Allow player to "refuse" certain actions */
1498 if (!get_item_allow(owner_ptr, k))
1504 /* Accept that choice */
1513 /* Fix the screen if necessary */
1518 /* Hack -- Cancel "display" */
1519 command_see = FALSE;
1522 /* Forget the tval restriction */
1525 /* Forget the item_tester_hook restriction */
1526 item_tester_hook = NULL;
1529 /* Clean up 'show choices' */
1530 if (toggle) toggle_inventory_equipment(owner_ptr);
1532 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
1533 handle_stuff(owner_ptr);
1535 /* Clear the prompt line */
1538 /* Warning if needed */
1539 if (oops && str) msg_print(str);
1544 if (command_cmd) prev_tag = cur_tag;
1545 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1553 * Choose an item and get auto-picker entry from it.
1555 object_type *choose_object(player_type *owner_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval)
1558 if (!get_item(owner_ptr, &item, q, s, option, tval)) return NULL;
1559 if (idx) *idx = item;
1560 if (item == INVEN_FORCE) return NULL;
1561 return REF_ITEM(owner_ptr, owner_ptr->current_floor_ptr, item);
1566 * todo ここの引数をfloor_typeにするとコンパイルが通らない、要確認
1567 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
1568 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
1569 * @param y 走査するフロアのY座標
1570 * @param x 走査するフロアのX座標
1571 * @param mode オプションフラグ
1572 * @return 対象のマスに落ちているアイテム数
1574 * Return a list of o_list[] indexes of items at the given floor
1575 * location. Valid flags are:
1577 * mode & 0x01 -- Item tester
1578 * mode & 0x02 -- Marked items only
1579 * mode & 0x04 -- Stop after first
1581 ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
1584 floor_type *floor_ptr = owner_ptr->current_floor_ptr;
1585 if (!in_bounds(floor_ptr, y, x)) return 0;
1587 /* Scan all objects in the grid */
1588 OBJECT_IDX this_o_idx, next_o_idx;
1589 ITEM_NUMBER num = 0;
1590 for (this_o_idx = floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1593 o_ptr = &floor_ptr->o_list[this_o_idx];
1594 next_o_idx = o_ptr->next_o_idx;
1597 if ((mode & 0x01) && !item_tester_okay(owner_ptr, o_ptr, item_tester_tval)) continue;
1600 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
1602 /* Accept this item */
1603 /* XXX Hack -- Enforce limit */
1605 items[num] = this_o_idx;
1610 if (mode & 0x04) break;
1618 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
1619 * @param target_item カーソルの初期値
1620 * @param y 走査するフロアのY座標
1621 * @param x 走査するフロアのX座標
1622 * @param min_width 表示の長さ
1623 * @return 選択したアイテムの添え字
1626 COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
1633 GAME_TEXT o_name[MAX_NLEN];
1636 COMMAND_CODE out_index[23];
1637 TERM_COLOR out_color[23];
1638 char out_desc[23][MAX_NLEN];
1639 COMMAND_CODE target_item_label = 0;
1641 OBJECT_IDX floor_list[23];
1642 ITEM_NUMBER floor_num;
1644 char floor_label[52 + 1];
1646 bool dont_need_to_show_weights = TRUE;
1648 Term_get_size(&wid, &hgt);
1650 /* Default length */
1651 int len = MAX((*min_width), 20);
1653 /* Scan for objects in the grid, using item_tester_okay() */
1654 floor_num = scan_floor(owner_ptr, floor_list, y, x, 0x03);
1656 /* Display the floor objects */
1657 floor_type *floor_ptr = owner_ptr->current_floor_ptr;
1658 for (k = 0, i = 0; i < floor_num && i < 23; i++)
1660 o_ptr = &floor_ptr->o_list[floor_list[i]];
1662 object_desc(owner_ptr, o_name, o_ptr, 0);
1664 /* Save the index */
1667 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
1669 /* Save the object description */
1670 strcpy(out_desc[k], o_name);
1672 /* Find the predicted "line length" */
1673 l = strlen(out_desc[k]) + 5;
1675 /* Be sure to account for the weight */
1676 if (show_weights) l += 9;
1678 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
1680 /* Maintain the maximum length */
1681 if (l > len) len = l;
1683 /* Advance to next "line" */
1687 if (show_weights && dont_need_to_show_weights) len -= 9;
1692 /* Find the column to start in */
1693 int col = (len > wid - 4) ? 0 : (wid - len - 1);
1695 prepare_label_string_floor(floor_ptr, floor_label, floor_list, floor_num);
1697 /* Output each entry */
1698 for (j = 0; j < k; j++)
1700 m = floor_list[out_index[j]];
1701 o_ptr = &floor_ptr->o_list[m];
1703 /* Clear the line */
1704 prt("", j + 1, col ? col - 2 : col);
1706 if (use_menu && target_item)
1708 if (j == (target_item - 1))
1710 strcpy(tmp_val, _("》", "> "));
1711 target_item_label = m;
1713 else strcpy(tmp_val, " ");
1717 /* Prepare an index --(-- */
1718 sprintf(tmp_val, "%c)", floor_label[j]);
1721 /* Clear the line with the (possibly indented) index */
1722 put_str(tmp_val, j + 1, col);
1724 /* Display the entry itself */
1725 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
1727 /* Display the weight if needed */
1728 if (show_weights && (o_ptr->tval != TV_GOLD))
1730 int wgt = o_ptr->weight * o_ptr->number;
1732 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1734 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1737 prt(tmp_val, j + 1, wid - 9);
1741 /* Make a "shadow" below the list (only if needed) */
1742 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
1744 return target_item_label;
1748 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
1749 * Let the user select an item, save its "index"
1750 * @param cp 選択したオブジェクトのIDを返す。
1751 * @param pmt 選択目的のメッセージ
1752 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
1753 * @param mode オプションフラグ
1754 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
1756 bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
1758 char n1 = ' ', n2 = ' ', which = ' ';
1761 COMMAND_CODE i1, i2;
1762 COMMAND_CODE e1, e2;
1770 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
1771 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
1772 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
1773 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
1775 bool allow_equip = FALSE;
1776 bool allow_inven = FALSE;
1777 bool allow_floor = FALSE;
1779 bool toggle = FALSE;
1784 ITEM_NUMBER floor_num;
1785 OBJECT_IDX floor_list[23];
1787 TERM_LEN min_width = 0;
1789 int menu_line = (use_menu ? 1 : 0);
1793 static char prev_tag = '\0';
1794 char cur_tag = '\0';
1796 /* Get the item index */
1797 if (repeat_pull(cp))
1800 if (force && (*cp == INVEN_FORCE))
1803 item_tester_hook = NULL;
1804 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1809 else if (floor && (*cp < 0))
1811 if (prev_tag && command_cmd)
1813 /* Scan all objects in the grid */
1814 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
1816 /* Look up the tag */
1817 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, prev_tag, floor_list, floor_num))
1819 /* Accept that choice */
1820 (*cp) = 0 - floor_list[k];
1822 /* Forget restrictions */
1824 item_tester_hook = NULL;
1825 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1831 prev_tag = '\0'; /* prev_tag is no longer effective */
1834 /* Validate the item */
1835 else if (item_tester_okay(owner_ptr, &owner_ptr->current_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL))
1837 /* Forget restrictions */
1839 item_tester_hook = NULL;
1840 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1847 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
1848 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
1850 if (prev_tag && command_cmd)
1852 /* Look up the tag and validate the item */
1853 if (!get_tag(owner_ptr, &k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
1854 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
1855 else if (!get_item_okay(owner_ptr, k)) /* Reject */;
1858 /* Accept that choice */
1861 /* Forget restrictions */
1863 item_tester_hook = NULL;
1864 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1870 prev_tag = '\0'; /* prev_tag is no longer effective */
1873 /* Verify the item */
1874 else if (get_item_okay(owner_ptr, *cp))
1876 /* Forget restrictions */
1878 item_tester_hook = NULL;
1879 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1893 /* No item selected */
1897 i2 = INVEN_PACK - 1;
1899 if (!inven) i2 = -1;
1902 for (j = 0; j < INVEN_PACK; j++)
1903 if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
1906 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1))) i1++;
1907 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2))) i2--;
1910 /* Full equipment */
1912 e2 = INVEN_TOTAL - 1;
1914 /* Forbid equipment */
1915 if (!equip) e2 = -1;
1918 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1919 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1920 if (owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
1923 /* Restrict equipment indexes */
1924 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1))) e1++;
1925 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2))) e2--;
1927 if (equip && owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
1929 if (owner_ptr->migite)
1931 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
1933 else if (owner_ptr->hidarite) e1 = INVEN_RARM;
1936 /* Count "okay" floor items */
1939 /* Restrict floor usage */
1942 /* Scan all objects in the grid */
1943 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
1946 if (i1 <= i2) allow_inven = TRUE;
1948 /* Accept equipment */
1949 if (e1 <= e2) allow_equip = TRUE;
1952 if (floor_num) allow_floor = TRUE;
1954 /* Require at least one legal choice */
1955 if (!allow_inven && !allow_equip && !allow_floor)
1957 command_see = FALSE;
1967 /* Analyze choices */
1970 /* Hack -- Start on equipment if requested */
1971 if (command_see && (command_wrk == (USE_EQUIP))
1974 command_wrk = (USE_EQUIP);
1977 else if (allow_inven)
1979 command_wrk = (USE_INVEN);
1982 /* Use equipment if allowed */
1983 else if (allow_equip)
1985 command_wrk = (USE_EQUIP);
1988 /* Use floor if allowed */
1989 else if (allow_floor)
1991 command_wrk = (USE_FLOOR);
1996 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
1998 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2000 /* Hack -- start out in "display" mode */
2006 /* Repeat until done */
2009 COMMAND_CODE get_item_label = 0;
2016 for (j = 0; j < 8; j++)
2019 if (!angband_term[j]) continue;
2021 /* Count windows displaying inven */
2022 if (window_flag[j] & (PW_INVEN)) ni++;
2024 /* Count windows displaying equip */
2025 if (window_flag[j] & (PW_EQUIP)) ne++;
2028 /* Toggle if needed */
2029 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
2030 (command_wrk == (USE_INVEN) && !ni && ne))
2032 toggle_inventory_equipment(owner_ptr);
2036 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
2037 handle_stuff(owner_ptr);
2039 /* Inventory screen */
2040 if (command_wrk == (USE_INVEN))
2042 /* Extract the legal requests */
2046 /* Redraw if needed */
2047 if (command_see) get_item_label = show_inventory(owner_ptr, menu_line, mode, tval);
2050 /* Equipment screen */
2051 else if (command_wrk == (USE_EQUIP))
2053 /* Extract the legal requests */
2054 n1 = I2A(e1 - INVEN_RARM);
2055 n2 = I2A(e2 - INVEN_RARM);
2057 /* Redraw if needed */
2058 if (command_see) get_item_label = show_equipment(owner_ptr, menu_line, mode, tval);
2062 else if (command_wrk == (USE_FLOOR))
2065 k = MIN(floor_top + 23, floor_num) - 1;
2067 /* Extract the legal requests */
2068 n1 = I2A(j - floor_top);
2069 n2 = I2A(k - floor_top);
2071 /* Redraw if needed */
2072 if (command_see) get_item_label = show_floor(owner_ptr, menu_line, owner_ptr->y, owner_ptr->x, &min_width);
2075 if (command_wrk == (USE_INVEN))
2077 /* Begin the prompt */
2078 sprintf(out_val, _("持ち物:", "Inven:"));
2082 /* Build the prompt */
2083 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2084 index_to_label(i1), index_to_label(i2));
2087 strcat(out_val, tmp_val);
2090 /* Indicate ability to "view" */
2091 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2097 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
2098 else if (allow_floor)
2099 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
2101 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2108 strcat(out_val, _(" '-'床上,", " - for floor,"));
2109 else if (allow_equip)
2110 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
2112 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2116 /* Viewing equipment */
2117 else if (command_wrk == (USE_EQUIP))
2119 /* Begin the prompt */
2120 sprintf(out_val, _("装備品:", "Equip:"));
2124 /* Build the prompt */
2125 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2126 index_to_label(e1), index_to_label(e2));
2129 strcat(out_val, tmp_val);
2132 /* Indicate ability to "view" */
2133 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2139 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2140 else if (allow_floor)
2141 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
2143 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2150 strcat(out_val, _(" '-'床上,", " - for floor,"));
2151 else if (allow_inven)
2152 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
2154 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2159 else if (command_wrk == (USE_FLOOR))
2161 /* Begin the prompt */
2162 sprintf(out_val, _("床上:", "Floor:"));
2166 /* Build the prompt */
2167 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
2170 strcat(out_val, tmp_val);
2173 /* Indicate ability to "view" */
2174 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2178 if (allow_inven && allow_equip)
2180 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
2182 else if (allow_inven)
2184 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2186 else if (allow_equip)
2188 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2192 else if (allow_inven)
2194 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2196 else if (allow_equip)
2198 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
2202 if (command_see && !use_menu)
2204 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
2209 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2211 /* Finish the prompt */
2212 strcat(out_val, " ESC");
2214 /* Build the prompt */
2215 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2217 /* Show the prompt */
2226 if (command_wrk == USE_INVEN) max_line = max_inven;
2227 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2228 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2244 menu_line += (max_line - 1);
2260 /* Verify legality */
2261 if (command_wrk == (USE_INVEN))
2263 if (allow_floor) command_wrk = USE_FLOOR;
2264 else if (allow_equip) command_wrk = USE_EQUIP;
2271 else if (command_wrk == (USE_EQUIP))
2273 if (allow_inven) command_wrk = USE_INVEN;
2274 else if (allow_floor) command_wrk = USE_FLOOR;
2281 else if (command_wrk == (USE_FLOOR))
2283 if (allow_equip) command_wrk = USE_EQUIP;
2284 else if (allow_inven) command_wrk = USE_INVEN;
2297 /* Hack -- Fix screen */
2304 /* Switch inven/equip */
2305 if (command_wrk == USE_INVEN) max_line = max_inven;
2306 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2307 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2308 if (menu_line > max_line) menu_line = max_line;
2310 /* Need to redraw */
2318 /* Verify legality */
2319 if (command_wrk == (USE_INVEN))
2321 if (allow_equip) command_wrk = USE_EQUIP;
2322 else if (allow_floor) command_wrk = USE_FLOOR;
2329 else if (command_wrk == (USE_EQUIP))
2331 if (allow_floor) command_wrk = USE_FLOOR;
2332 else if (allow_inven) command_wrk = USE_INVEN;
2339 else if (command_wrk == (USE_FLOOR))
2341 if (allow_inven) command_wrk = USE_INVEN;
2342 else if (allow_equip) command_wrk = USE_EQUIP;
2355 /* Hack -- Fix screen */
2362 /* Switch inven/equip */
2363 if (command_wrk == USE_INVEN) max_line = max_inven;
2364 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2365 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2366 if (menu_line > max_line) menu_line = max_line;
2368 /* Need to redraw */
2377 if (command_wrk == USE_FLOOR)
2380 (*cp) = -get_item_label;
2384 /* Validate the item */
2385 if (!get_item_okay(owner_ptr, get_item_label))
2391 /* Allow player to "refuse" certain actions */
2392 if (!get_item_allow(owner_ptr, get_item_label))
2398 /* Accept that choice */
2399 (*cp) = get_item_label;
2417 if (menu_line > max_line) menu_line -= max_line;
2438 command_see = FALSE;
2459 grid_type *g_ptr = &owner_ptr->current_floor_ptr->grid_array[owner_ptr->y][owner_ptr->x];
2461 if (command_wrk != (USE_FLOOR)) break;
2463 /* Get the object being moved. */
2464 o_idx = g_ptr->o_idx;
2466 /* Only rotate a pile of two or more objects. */
2467 if (!(o_idx && owner_ptr->current_floor_ptr->o_list[o_idx].next_o_idx)) break;
2469 /* Remove the first object from the list. */
2470 excise_object_idx(owner_ptr->current_floor_ptr, o_idx);
2472 /* Find end of the list. */
2474 while (owner_ptr->current_floor_ptr->o_list[i].next_o_idx)
2475 i = owner_ptr->current_floor_ptr->o_list[i].next_o_idx;
2477 /* Add after the last object. */
2478 owner_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx;
2480 /* Re-scan floor list */
2481 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
2483 /* Hack -- Fix screen */
2495 if (command_wrk == (USE_INVEN))
2502 command_wrk = (USE_EQUIP);
2504 else if (command_wrk == (USE_EQUIP))
2511 command_wrk = (USE_INVEN);
2513 else if (command_wrk == (USE_FLOOR))
2517 command_wrk = (USE_INVEN);
2519 else if (allow_equip)
2521 command_wrk = (USE_EQUIP);
2530 /* Hack -- Fix screen */
2537 /* Need to redraw */
2550 * If we are already examining the floor, and there
2551 * is only one item, we will always select it.
2552 * If we aren't examining the floor and there is only
2553 * one item, we will select it if floor_query_flag
2558 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
2561 k = 0 - floor_list[0];
2563 /* Allow player to "refuse" certain actions */
2564 if (!get_item_allow(owner_ptr, k))
2570 /* Accept that choice */
2579 /* Hack -- Fix screen */
2586 command_wrk = (USE_FLOOR);
2592 case '1': case '2': case '3':
2593 case '4': case '5': case '6':
2594 case '7': case '8': case '9':
2596 if (command_wrk != USE_FLOOR)
2598 /* Look up the tag */
2599 if (!get_tag(owner_ptr, &k, which, command_wrk, tval))
2605 /* Hack -- Validate the item */
2606 if ((k < INVEN_RARM) ? !inven : !equip)
2612 /* Validate the item */
2613 if (!get_item_okay(owner_ptr, k))
2621 /* Look up the alphabetical tag */
2622 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, which, floor_list, floor_num))
2625 k = 0 - floor_list[k];
2634 /* Allow player to "refuse" certain actions */
2635 if (!get_item_allow(owner_ptr, k))
2641 /* Accept that choice */
2664 if (command_wrk != USE_FLOOR)
2666 bool not_found = FALSE;
2668 /* Look up the alphabetical tag */
2669 if (!get_tag(owner_ptr, &k, which, command_wrk, tval))
2674 /* Hack -- Validate the item */
2675 else if ((k < INVEN_RARM) ? !inven : !equip)
2680 /* Validate the item */
2681 else if (!get_item_okay(owner_ptr, k))
2688 /* Accept that choice */
2698 /* Look up the alphabetical tag */
2699 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, which, floor_list, floor_num))
2702 k = 0 - floor_list[k];
2704 /* Accept that choice */
2713 /* Extract "query" setting */
2714 ver = isupper(which);
2715 which = (char)tolower(which);
2717 if (command_wrk == (USE_INVEN))
2719 if (which == '(') k = i1;
2720 else if (which == ')') k = i2;
2721 else k = label_to_inventory(owner_ptr, which);
2724 /* Convert letter to equipment index */
2725 else if (command_wrk == (USE_EQUIP))
2727 if (which == '(') k = e1;
2728 else if (which == ')') k = e2;
2729 else k = label_to_equipment(owner_ptr, which);
2732 /* Convert letter to floor index */
2733 else if (command_wrk == USE_FLOOR)
2735 if (which == '(') k = 0;
2736 else if (which == ')') k = floor_num - 1;
2737 else k = islower(which) ? A2I(which) : -1;
2738 if (k < 0 || k >= floor_num || k >= 23)
2745 k = 0 - floor_list[k];
2748 /* Validate the item */
2749 if ((command_wrk != USE_FLOOR) && !get_item_okay(owner_ptr, k))
2755 /* Verify the item */
2756 if (ver && !verify(owner_ptr, _("本当に", "Try"), k))
2762 /* Allow player to "refuse" certain actions */
2763 if (!get_item_allow(owner_ptr, k))
2769 /* Accept that choice */
2778 /* Fix the screen if necessary */
2783 /* Hack -- Cancel "display" */
2784 command_see = FALSE;
2788 /* Forget the tval restriction */
2791 /* Forget the item_tester_hook restriction */
2792 item_tester_hook = NULL;
2795 /* Clean up 'show choices' */
2796 if (toggle) toggle_inventory_equipment(owner_ptr);
2798 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
2799 handle_stuff(owner_ptr);
2801 /* Clear the prompt line */
2804 /* Warning if needed */
2805 if (oops && str) msg_print(str);
2810 if (command_cmd) prev_tag = cur_tag;
2811 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2817 * @brief 床上のアイテムを拾う選択用サブルーチン
2818 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
2820 static bool py_pickup_floor_aux(player_type *owner_ptr)
2822 OBJECT_IDX this_o_idx;
2826 /* Restrict the choices */
2827 item_tester_hook = inven_carry_okay;
2830 q = _("どれを拾いますか?", "Get which item? ");
2831 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
2833 if (choose_object(owner_ptr, &item, q, s, (USE_FLOOR), 0))
2835 this_o_idx = 0 - item;
2842 /* Pick up the object */
2843 py_pickup_aux(owner_ptr, this_o_idx);
2849 * @brief 床上のアイテムを拾うメイン処理
2850 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
2853 * This is called by py_pickup() when easy_floor is TRUE.
2855 void py_pickup_floor(player_type *owner_ptr, bool pickup)
2857 OBJECT_IDX this_o_idx, next_o_idx = 0;
2859 GAME_TEXT o_name[MAX_NLEN];
2863 OBJECT_IDX floor_o_idx = 0;
2867 /* Scan the pile of objects */
2868 for (this_o_idx = owner_ptr->current_floor_ptr->grid_array[owner_ptr->y][owner_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2870 /* Access the object */
2871 o_ptr = &owner_ptr->current_floor_ptr->o_list[this_o_idx];
2873 object_desc(owner_ptr, o_name, o_ptr, 0);
2875 /* Access the next object */
2876 next_o_idx = o_ptr->next_o_idx;
2878 disturb(owner_ptr, FALSE, FALSE);
2881 if (o_ptr->tval == TV_GOLD)
2884 msg_format(" $%ld の価値がある%sを見つけた。",
2885 (long)o_ptr->pval, o_name);
2887 msg_format("You have found %ld gold pieces worth of %s.",
2888 (long)o_ptr->pval, o_name);
2891 /* Collect the gold */
2892 owner_ptr->au += o_ptr->pval;
2895 owner_ptr->redraw |= (PR_GOLD);
2897 owner_ptr->window |= (PW_PLAYER);
2899 /* Delete the gold */
2900 delete_object_idx(owner_ptr, this_o_idx);
2902 /* Check the next object */
2905 else if (o_ptr->marked & OM_NOMSG)
2907 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
2908 * ignored. Otherwise, they are included in the prompt. */
2909 o_ptr->marked &= ~(OM_NOMSG);
2913 /* Count non-gold objects that can be picked up. */
2914 if (inven_carry_okay(o_ptr))
2919 /* Count non-gold objects */
2922 /* Remember this index */
2923 floor_o_idx = this_o_idx;
2926 /* There are no non-gold objects */
2930 /* Mention the number of objects */
2936 /* Access the object */
2937 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2938 object_desc(owner_ptr, o_name, o_ptr, 0);
2940 msg_format(_("%sがある。", "You see %s."), o_name);
2943 /* Multiple objects */
2946 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
2952 /* The player has no room for anything on the floor. */
2958 /* Access the object */
2959 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2960 object_desc(owner_ptr, o_name, o_ptr, 0);
2962 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
2965 /* Multiple objects */
2968 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
2977 while (can_pickup--)
2979 if (!py_pickup_floor_aux(owner_ptr)) break;
2985 /* Hack -- query every object */
2986 if (carry_query_flag)
2988 char out_val[MAX_NLEN + 20];
2990 /* Access the object */
2991 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2992 object_desc(owner_ptr, o_name, o_ptr, 0);
2994 (void)sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
2996 /* Ask the user to confirm */
2997 if (!get_check(out_val))
3003 /* Access the object */
3004 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
3006 /* Pick up the object */
3007 py_pickup_aux(owner_ptr, floor_o_idx);
3012 * @brief 所持アイテム一覧を表示する /
3013 * Choice window "shadow" of the "show_inven()" function
3016 void display_inventory(player_type *owner_ptr, OBJECT_TYPE_VALUE tval)
3018 register int i, n, z = 0;
3020 TERM_COLOR attr = TERM_WHITE;
3022 GAME_TEXT o_name[MAX_NLEN];
3025 if (!owner_ptr || !owner_ptr->inventory_list) return;
3027 Term_get_size(&wid, &hgt);
3029 for (i = 0; i < INVEN_PACK; i++)
3031 o_ptr = &owner_ptr->inventory_list[i];
3032 if (!o_ptr->k_idx) continue;
3036 for (i = 0; i < z; i++)
3038 o_ptr = &owner_ptr->inventory_list[i];
3039 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3040 if (item_tester_okay(owner_ptr, o_ptr, tval))
3042 tmp_val[0] = index_to_label(i);
3046 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
3047 object_desc(owner_ptr, o_name, o_ptr, 0);
3049 attr = tval_to_attr[o_ptr->tval % 128];
3055 Term_putstr(3, i, n, attr, o_name);
3056 Term_erase(3 + n, i, 255);
3060 int wgt = o_ptr->weight * o_ptr->number;
3062 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3064 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3066 prt(tmp_val, i, wid - 9);
3070 for (i = z; i < hgt; i++)
3072 Term_erase(0, i, 255);
3078 * @brief 装備アイテムの表示を行う /
3079 * Display the equipment.
3080 * @param target_item アイテムの選択処理を行うか否か。
3081 * @return 選択したアイテムのタグ
3083 COMMAND_CODE show_equipment(player_type *owner_ptr, int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
3089 GAME_TEXT o_name[MAX_NLEN];
3090 COMMAND_CODE out_index[23];
3091 TERM_COLOR out_color[23];
3092 char out_desc[23][MAX_NLEN];
3093 COMMAND_CODE target_item_label = 0;
3095 char equip_label[52 + 1];
3097 /* Starting column */
3098 int col = command_gap;
3100 Term_get_size(&wid, &hgt);
3102 /* Maximal length */
3103 int len = wid - col - 1;
3105 /* Scan the equipment list */
3106 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3108 o_ptr = &owner_ptr->inventory_list[i];
3110 /* Is this item acceptable? */
3111 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL)) &&
3112 (!((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute) ||
3113 (mode & IGNORE_BOTHHAND_SLOT))) continue;
3115 object_desc(owner_ptr, o_name, o_ptr, 0);
3117 if ((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute)
3119 (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)"));
3120 out_color[k] = TERM_WHITE;
3124 (void)strcpy(out_desc[k], o_name);
3125 out_color[k] = tval_to_attr[o_ptr->tval % 128];
3129 /* Grey out charging items */
3132 out_color[k] = TERM_L_DARK;
3135 /* Extract the maximal length (see below) */
3137 l = strlen(out_desc[k]) + (2 + 1);
3139 l = strlen(out_desc[k]) + (2 + 3);
3143 /* Increase length for labels (if needed) */
3145 if (show_labels) l += (7 + 2);
3147 if (show_labels) l += (14 + 2);
3151 /* Increase length for weight (if needed) */
3152 if (show_weights) l += 9;
3154 if (show_item_graph) l += 2;
3156 /* Maintain the max-length */
3157 if (l > len) len = l;
3159 /* Advance the entry */
3163 /* Hack -- Find a column to start in */
3165 col = (len > wid - 6) ? 0 : (wid - len - 1);
3167 col = (len > wid - 4) ? 0 : (wid - len - 1);
3170 prepare_label_string(owner_ptr, equip_label, USE_EQUIP, tval);
3172 /* Output each entry */
3173 for (j = 0; j < k; j++)
3176 o_ptr = &owner_ptr->inventory_list[i];
3178 /* Clear the line */
3179 prt("", j + 1, col ? col - 2 : col);
3181 if (use_menu && target_item)
3183 if (j == (target_item - 1))
3185 strcpy(tmp_val, _("》", "> "));
3186 target_item_label = i;
3188 else strcpy(tmp_val, " ");
3190 else if (i >= INVEN_RARM)
3192 /* Prepare an index --(-- */
3193 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
3197 /* Prepare an index --(-- */
3198 sprintf(tmp_val, "%c)", index_to_label(i));
3201 /* Clear the line with the (possibly indented) index */
3202 put_str(tmp_val, j + 1, col);
3204 int cur_col = col + 3;
3206 /* Display graphics for object, if desired */
3207 if (show_item_graph)
3209 TERM_COLOR a = object_attr(o_ptr);
3210 SYMBOL_CODE c = object_char(o_ptr);
3211 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
3212 if (use_bigtile) cur_col++;
3220 /* Mention the use */
3221 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(owner_ptr, i));
3223 put_str(tmp_val, j + 1, cur_col);
3225 /* Display the entry itself */
3226 c_put_str(out_color[j], out_desc[j], j + 1, _(cur_col + 9, cur_col + 16));
3232 /* Display the entry itself */
3233 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
3236 /* Display the weight if needed */
3237 if (!show_weights) continue;
3239 int wgt = o_ptr->weight * o_ptr->number;
3241 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3243 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
3246 prt(tmp_val, j + 1, wid - 9);
3249 /* Make a "shadow" below the list (only if needed) */
3250 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3252 /* Save the new column */
3255 return target_item_label;
3260 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
3261 * Return a string describing how a given item is being worn.
3262 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
3263 * @return 状態表現内容の文字列ポインタ
3265 * Currently, only used for items in the equipment, inventory.
3267 concptr describe_use(player_type *owner_ptr, int i)
3273 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "運搬中の" : ((owner_ptr->ryoute && owner_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
3275 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "just lifting" : (owner_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
3279 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "運搬中の" : ((owner_ptr->ryoute && owner_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
3281 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "just lifting" : (owner_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
3284 case INVEN_BOW: p = (adj_str_hold[owner_ptr->stat_ind[A_STR]] < owner_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
3285 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
3286 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
3287 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
3288 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
3289 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
3290 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
3291 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
3292 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
3293 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
3294 default: p = _("ザックに入っている", "carrying in your pack"); break;
3297 /* Return the result */