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) {
1435 bool not_found = FALSE;
1437 /* Look up the alphabetical tag */
1438 if (!get_tag(owner_ptr, &k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1443 /* Hack -- Validate the item */
1444 else if ((k < INVEN_RARM) ? !inven : !equip)
1449 /* Validate the item */
1450 else if (!get_item_okay(owner_ptr, k))
1457 /* Accept that choice */
1465 /* Extract "query" setting */
1466 ver = isupper(which);
1467 which = (char)tolower(which);
1471 if (which == '(') k = i1;
1472 else if (which == ')') k = i2;
1473 else k = label_to_inventory(owner_ptr, which);
1476 /* Convert letter to equipment index */
1479 if (which == '(') k = e1;
1480 else if (which == ')') k = e2;
1481 else k = label_to_equipment(owner_ptr, which);
1484 /* Validate the item */
1485 if (!get_item_okay(owner_ptr, k))
1491 /* Verify the item */
1492 if (ver && !verify(owner_ptr, _("本当に", "Try"), k))
1498 /* Allow player to "refuse" certain actions */
1499 if (!get_item_allow(owner_ptr, k))
1505 /* Accept that choice */
1514 /* Fix the screen if necessary */
1519 /* Hack -- Cancel "display" */
1520 command_see = FALSE;
1523 /* Forget the tval restriction */
1526 /* Forget the item_tester_hook restriction */
1527 item_tester_hook = NULL;
1530 /* Clean up 'show choices' */
1531 if (toggle) toggle_inventory_equipment(owner_ptr);
1533 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
1534 handle_stuff(owner_ptr);
1536 /* Clear the prompt line */
1539 /* Warning if needed */
1540 if (oops && str) msg_print(str);
1545 if (command_cmd) prev_tag = cur_tag;
1546 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1554 * Choose an item and get auto-picker entry from it.
1556 object_type *choose_object(player_type *owner_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval)
1559 if (!get_item(owner_ptr, &item, q, s, option, tval)) return NULL;
1560 if (idx) *idx = item;
1561 if (item == INVEN_FORCE) return NULL;
1562 return REF_ITEM(owner_ptr, owner_ptr->current_floor_ptr, item);
1567 * todo ここの引数をfloor_typeにするとコンパイルが通らない、要確認
1568 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
1569 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
1570 * @param y 走査するフロアのY座標
1571 * @param x 走査するフロアのX座標
1572 * @param mode オプションフラグ
1573 * @return 対象のマスに落ちているアイテム数
1575 * Return a list of o_list[] indexes of items at the given floor
1576 * location. Valid flags are:
1578 * mode & 0x01 -- Item tester
1579 * mode & 0x02 -- Marked items only
1580 * mode & 0x04 -- Stop after first
1582 ITEM_NUMBER scan_floor(player_type *owner_ptr, OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
1585 floor_type *floor_ptr = owner_ptr->current_floor_ptr;
1586 if (!in_bounds(floor_ptr, y, x)) return 0;
1588 /* Scan all objects in the grid */
1589 OBJECT_IDX this_o_idx, next_o_idx;
1590 ITEM_NUMBER num = 0;
1591 for (this_o_idx = floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1594 o_ptr = &floor_ptr->o_list[this_o_idx];
1595 next_o_idx = o_ptr->next_o_idx;
1598 if ((mode & 0x01) && !item_tester_okay(owner_ptr, o_ptr, item_tester_tval)) continue;
1601 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
1603 /* Accept this item */
1604 /* XXX Hack -- Enforce limit */
1606 items[num] = this_o_idx;
1611 if (mode & 0x04) break;
1619 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
1620 * @param target_item カーソルの初期値
1621 * @param y 走査するフロアのY座標
1622 * @param x 走査するフロアのX座標
1623 * @param min_width 表示の長さ
1624 * @return 選択したアイテムの添え字
1627 COMMAND_CODE show_floor(player_type *owner_ptr, int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
1634 GAME_TEXT o_name[MAX_NLEN];
1637 COMMAND_CODE out_index[23];
1638 TERM_COLOR out_color[23];
1639 char out_desc[23][MAX_NLEN];
1640 COMMAND_CODE target_item_label = 0;
1642 OBJECT_IDX floor_list[23];
1643 ITEM_NUMBER floor_num;
1645 char floor_label[52 + 1];
1647 bool dont_need_to_show_weights = TRUE;
1649 Term_get_size(&wid, &hgt);
1651 /* Default length */
1652 int len = MAX((*min_width), 20);
1654 /* Scan for objects in the grid, using item_tester_okay() */
1655 floor_num = scan_floor(owner_ptr, floor_list, y, x, 0x03);
1657 /* Display the floor objects */
1658 floor_type *floor_ptr = owner_ptr->current_floor_ptr;
1659 for (k = 0, i = 0; i < floor_num && i < 23; i++)
1661 o_ptr = &floor_ptr->o_list[floor_list[i]];
1663 object_desc(owner_ptr, o_name, o_ptr, 0);
1665 /* Save the index */
1668 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
1670 /* Save the object description */
1671 strcpy(out_desc[k], o_name);
1673 /* Find the predicted "line length" */
1674 l = strlen(out_desc[k]) + 5;
1676 /* Be sure to account for the weight */
1677 if (show_weights) l += 9;
1679 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
1681 /* Maintain the maximum length */
1682 if (l > len) len = l;
1684 /* Advance to next "line" */
1688 if (show_weights && dont_need_to_show_weights) len -= 9;
1693 /* Find the column to start in */
1694 int col = (len > wid - 4) ? 0 : (wid - len - 1);
1696 prepare_label_string_floor(floor_ptr, floor_label, floor_list, floor_num);
1698 /* Output each entry */
1699 for (j = 0; j < k; j++)
1701 m = floor_list[out_index[j]];
1702 o_ptr = &floor_ptr->o_list[m];
1704 /* Clear the line */
1705 prt("", j + 1, col ? col - 2 : col);
1707 if (use_menu && target_item)
1709 if (j == (target_item - 1))
1711 strcpy(tmp_val, _("》", "> "));
1712 target_item_label = m;
1714 else strcpy(tmp_val, " ");
1718 /* Prepare an index --(-- */
1719 sprintf(tmp_val, "%c)", floor_label[j]);
1722 /* Clear the line with the (possibly indented) index */
1723 put_str(tmp_val, j + 1, col);
1725 /* Display the entry itself */
1726 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
1728 /* Display the weight if needed */
1729 if (show_weights && (o_ptr->tval != TV_GOLD))
1731 int wgt = o_ptr->weight * o_ptr->number;
1733 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1735 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1738 prt(tmp_val, j + 1, wid - 9);
1742 /* Make a "shadow" below the list (only if needed) */
1743 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
1745 return target_item_label;
1749 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
1750 * Let the user select an item, save its "index"
1751 * @param cp 選択したオブジェクトのIDを返す。
1752 * @param pmt 選択目的のメッセージ
1753 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
1754 * @param mode オプションフラグ
1755 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
1757 bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
1759 char n1 = ' ', n2 = ' ', which = ' ';
1762 COMMAND_CODE i1, i2;
1763 COMMAND_CODE e1, e2;
1771 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
1772 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
1773 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
1774 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
1776 bool allow_equip = FALSE;
1777 bool allow_inven = FALSE;
1778 bool allow_floor = FALSE;
1780 bool toggle = FALSE;
1785 ITEM_NUMBER floor_num;
1786 OBJECT_IDX floor_list[23];
1788 TERM_LEN min_width = 0;
1790 int menu_line = (use_menu ? 1 : 0);
1794 static char prev_tag = '\0';
1795 char cur_tag = '\0';
1797 /* Get the item index */
1798 if (repeat_pull(cp))
1801 if (force && (*cp == INVEN_FORCE))
1804 item_tester_hook = NULL;
1805 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1810 else if (floor && (*cp < 0))
1812 if (prev_tag && command_cmd)
1814 /* Scan all objects in the grid */
1815 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
1817 /* Look up the tag */
1818 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, prev_tag, floor_list, floor_num))
1820 /* Accept that choice */
1821 (*cp) = 0 - floor_list[k];
1823 /* Forget restrictions */
1825 item_tester_hook = NULL;
1826 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1832 prev_tag = '\0'; /* prev_tag is no longer effective */
1835 /* Validate the item */
1836 else if (item_tester_okay(owner_ptr, &owner_ptr->current_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL))
1838 /* Forget restrictions */
1840 item_tester_hook = NULL;
1841 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1848 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
1849 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
1851 if (prev_tag && command_cmd)
1853 /* Look up the tag and validate the item */
1854 if (!get_tag(owner_ptr, &k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
1855 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
1856 else if (!get_item_okay(owner_ptr, k)) /* Reject */;
1859 /* Accept that choice */
1862 /* Forget restrictions */
1864 item_tester_hook = NULL;
1865 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1871 prev_tag = '\0'; /* prev_tag is no longer effective */
1874 /* Verify the item */
1875 else if (get_item_okay(owner_ptr, *cp))
1877 /* Forget restrictions */
1879 item_tester_hook = NULL;
1880 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1894 /* No item selected */
1898 i2 = INVEN_PACK - 1;
1900 if (!inven) i2 = -1;
1903 for (j = 0; j < INVEN_PACK; j++)
1904 if (item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
1907 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i1))) i1++;
1908 while ((i1 <= i2) && (!get_item_okay(owner_ptr, i2))) i2--;
1911 /* Full equipment */
1913 e2 = INVEN_TOTAL - 1;
1915 /* Forbid equipment */
1916 if (!equip) e2 = -1;
1919 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1920 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(owner_ptr, &owner_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1921 if (owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
1924 /* Restrict equipment indexes */
1925 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e1))) e1++;
1926 while ((e1 <= e2) && (!get_item_okay(owner_ptr, e2))) e2--;
1928 if (equip && owner_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
1930 if (owner_ptr->migite)
1932 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
1934 else if (owner_ptr->hidarite) e1 = INVEN_RARM;
1937 /* Count "okay" floor items */
1940 /* Restrict floor usage */
1943 /* Scan all objects in the grid */
1944 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
1947 if (i1 <= i2) allow_inven = TRUE;
1949 /* Accept equipment */
1950 if (e1 <= e2) allow_equip = TRUE;
1953 if (floor_num) allow_floor = TRUE;
1955 /* Require at least one legal choice */
1956 if (!allow_inven && !allow_equip && !allow_floor)
1958 command_see = FALSE;
1968 /* Analyze choices */
1971 /* Hack -- Start on equipment if requested */
1972 if (command_see && (command_wrk == (USE_EQUIP))
1975 command_wrk = (USE_EQUIP);
1978 else if (allow_inven)
1980 command_wrk = (USE_INVEN);
1983 /* Use equipment if allowed */
1984 else if (allow_equip)
1986 command_wrk = (USE_EQUIP);
1989 /* Use floor if allowed */
1990 else if (allow_floor)
1992 command_wrk = (USE_FLOOR);
1997 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
1999 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2001 /* Hack -- start out in "display" mode */
2007 /* Repeat until done */
2010 COMMAND_CODE get_item_label = 0;
2017 for (j = 0; j < 8; j++)
2020 if (!angband_term[j]) continue;
2022 /* Count windows displaying inven */
2023 if (window_flag[j] & (PW_INVEN)) ni++;
2025 /* Count windows displaying equip */
2026 if (window_flag[j] & (PW_EQUIP)) ne++;
2029 /* Toggle if needed */
2030 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
2031 (command_wrk == (USE_INVEN) && !ni && ne))
2033 toggle_inventory_equipment(owner_ptr);
2037 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
2038 handle_stuff(owner_ptr);
2040 /* Inventory screen */
2041 if (command_wrk == (USE_INVEN))
2043 /* Extract the legal requests */
2047 /* Redraw if needed */
2048 if (command_see) get_item_label = show_inventory(owner_ptr, menu_line, mode, tval);
2051 /* Equipment screen */
2052 else if (command_wrk == (USE_EQUIP))
2054 /* Extract the legal requests */
2055 n1 = I2A(e1 - INVEN_RARM);
2056 n2 = I2A(e2 - INVEN_RARM);
2058 /* Redraw if needed */
2059 if (command_see) get_item_label = show_equipment(owner_ptr, menu_line, mode, tval);
2063 else if (command_wrk == (USE_FLOOR))
2066 k = MIN(floor_top + 23, floor_num) - 1;
2068 /* Extract the legal requests */
2069 n1 = I2A(j - floor_top);
2070 n2 = I2A(k - floor_top);
2072 /* Redraw if needed */
2073 if (command_see) get_item_label = show_floor(owner_ptr, menu_line, owner_ptr->y, owner_ptr->x, &min_width);
2076 if (command_wrk == (USE_INVEN))
2078 /* Begin the prompt */
2079 sprintf(out_val, _("持ち物:", "Inven:"));
2083 /* Build the prompt */
2084 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2085 index_to_label(i1), index_to_label(i2));
2088 strcat(out_val, tmp_val);
2091 /* Indicate ability to "view" */
2092 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2098 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
2099 else if (allow_floor)
2100 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
2102 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2109 strcat(out_val, _(" '-'床上,", " - for floor,"));
2110 else if (allow_equip)
2111 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
2113 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2117 /* Viewing equipment */
2118 else if (command_wrk == (USE_EQUIP))
2120 /* Begin the prompt */
2121 sprintf(out_val, _("装備品:", "Equip:"));
2125 /* Build the prompt */
2126 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2127 index_to_label(e1), index_to_label(e2));
2130 strcat(out_val, tmp_val);
2133 /* Indicate ability to "view" */
2134 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2140 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2141 else if (allow_floor)
2142 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
2144 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2151 strcat(out_val, _(" '-'床上,", " - for floor,"));
2152 else if (allow_inven)
2153 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
2155 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2160 else if (command_wrk == (USE_FLOOR))
2162 /* Begin the prompt */
2163 sprintf(out_val, _("床上:", "Floor:"));
2167 /* Build the prompt */
2168 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
2171 strcat(out_val, tmp_val);
2174 /* Indicate ability to "view" */
2175 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2179 if (allow_inven && allow_equip)
2181 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
2183 else if (allow_inven)
2185 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2187 else if (allow_equip)
2189 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2193 else if (allow_inven)
2195 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2197 else if (allow_equip)
2199 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
2203 if (command_see && !use_menu)
2205 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
2210 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2212 /* Finish the prompt */
2213 strcat(out_val, " ESC");
2215 /* Build the prompt */
2216 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2218 /* Show the prompt */
2227 if (command_wrk == USE_INVEN) max_line = max_inven;
2228 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2229 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2245 menu_line += (max_line - 1);
2261 /* Verify legality */
2262 if (command_wrk == (USE_INVEN))
2264 if (allow_floor) command_wrk = USE_FLOOR;
2265 else if (allow_equip) command_wrk = USE_EQUIP;
2272 else if (command_wrk == (USE_EQUIP))
2274 if (allow_inven) command_wrk = USE_INVEN;
2275 else if (allow_floor) command_wrk = USE_FLOOR;
2282 else if (command_wrk == (USE_FLOOR))
2284 if (allow_equip) command_wrk = USE_EQUIP;
2285 else if (allow_inven) command_wrk = USE_INVEN;
2298 /* Hack -- Fix screen */
2305 /* Switch inven/equip */
2306 if (command_wrk == USE_INVEN) max_line = max_inven;
2307 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2308 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2309 if (menu_line > max_line) menu_line = max_line;
2311 /* Need to redraw */
2319 /* Verify legality */
2320 if (command_wrk == (USE_INVEN))
2322 if (allow_equip) command_wrk = USE_EQUIP;
2323 else if (allow_floor) command_wrk = USE_FLOOR;
2330 else if (command_wrk == (USE_EQUIP))
2332 if (allow_floor) command_wrk = USE_FLOOR;
2333 else if (allow_inven) command_wrk = USE_INVEN;
2340 else if (command_wrk == (USE_FLOOR))
2342 if (allow_inven) command_wrk = USE_INVEN;
2343 else if (allow_equip) command_wrk = USE_EQUIP;
2356 /* Hack -- Fix screen */
2363 /* Switch inven/equip */
2364 if (command_wrk == USE_INVEN) max_line = max_inven;
2365 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2366 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2367 if (menu_line > max_line) menu_line = max_line;
2369 /* Need to redraw */
2378 if (command_wrk == USE_FLOOR)
2381 (*cp) = -get_item_label;
2385 /* Validate the item */
2386 if (!get_item_okay(owner_ptr, get_item_label))
2392 /* Allow player to "refuse" certain actions */
2393 if (!get_item_allow(owner_ptr, get_item_label))
2399 /* Accept that choice */
2400 (*cp) = get_item_label;
2418 if (menu_line > max_line) menu_line -= max_line;
2439 command_see = FALSE;
2460 grid_type *g_ptr = &owner_ptr->current_floor_ptr->grid_array[owner_ptr->y][owner_ptr->x];
2462 if (command_wrk != (USE_FLOOR)) break;
2464 /* Get the object being moved. */
2465 o_idx = g_ptr->o_idx;
2467 /* Only rotate a pile of two or more objects. */
2468 if (!(o_idx && owner_ptr->current_floor_ptr->o_list[o_idx].next_o_idx)) break;
2470 /* Remove the first object from the list. */
2471 excise_object_idx(owner_ptr->current_floor_ptr, o_idx);
2473 /* Find end of the list. */
2475 while (owner_ptr->current_floor_ptr->o_list[i].next_o_idx)
2476 i = owner_ptr->current_floor_ptr->o_list[i].next_o_idx;
2478 /* Add after the last object. */
2479 owner_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx;
2481 /* Re-scan floor list */
2482 floor_num = scan_floor(owner_ptr, floor_list, owner_ptr->y, owner_ptr->x, 0x03);
2484 /* Hack -- Fix screen */
2496 if (command_wrk == (USE_INVEN))
2503 command_wrk = (USE_EQUIP);
2505 else if (command_wrk == (USE_EQUIP))
2512 command_wrk = (USE_INVEN);
2514 else if (command_wrk == (USE_FLOOR))
2518 command_wrk = (USE_INVEN);
2520 else if (allow_equip)
2522 command_wrk = (USE_EQUIP);
2531 /* Hack -- Fix screen */
2538 /* Need to redraw */
2551 * If we are already examining the floor, and there
2552 * is only one item, we will always select it.
2553 * If we aren't examining the floor and there is only
2554 * one item, we will select it if floor_query_flag
2559 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
2562 k = 0 - floor_list[0];
2564 /* Allow player to "refuse" certain actions */
2565 if (!get_item_allow(owner_ptr, k))
2571 /* Accept that choice */
2580 /* Hack -- Fix screen */
2587 command_wrk = (USE_FLOOR);
2593 case '1': case '2': case '3':
2594 case '4': case '5': case '6':
2595 case '7': case '8': case '9':
2597 if (command_wrk != USE_FLOOR)
2599 /* Look up the tag */
2600 if (!get_tag(owner_ptr, &k, which, command_wrk, tval))
2606 /* Hack -- Validate the item */
2607 if ((k < INVEN_RARM) ? !inven : !equip)
2613 /* Validate the item */
2614 if (!get_item_okay(owner_ptr, k))
2622 /* Look up the alphabetical tag */
2623 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, which, floor_list, floor_num))
2626 k = 0 - floor_list[k];
2635 /* Allow player to "refuse" certain actions */
2636 if (!get_item_allow(owner_ptr, k))
2642 /* Accept that choice */
2666 if (command_wrk != USE_FLOOR)
2668 bool not_found = FALSE;
2670 /* Look up the alphabetical tag */
2671 if (!get_tag(owner_ptr, &k, which, command_wrk, tval))
2676 /* Hack -- Validate the item */
2677 else if ((k < INVEN_RARM) ? !inven : !equip)
2682 /* Validate the item */
2683 else if (!get_item_okay(owner_ptr, k))
2690 /* Accept that choice */
2700 /* Look up the alphabetical tag */
2701 if (get_tag_floor(owner_ptr->current_floor_ptr, &k, which, floor_list, floor_num))
2704 k = 0 - floor_list[k];
2706 /* Accept that choice */
2715 /* Extract "query" setting */
2716 ver = isupper(which);
2717 which = (char)tolower(which);
2719 if (command_wrk == (USE_INVEN))
2721 if (which == '(') k = i1;
2722 else if (which == ')') k = i2;
2723 else k = label_to_inventory(owner_ptr, which);
2726 /* Convert letter to equipment index */
2727 else if (command_wrk == (USE_EQUIP))
2729 if (which == '(') k = e1;
2730 else if (which == ')') k = e2;
2731 else k = label_to_equipment(owner_ptr, which);
2734 /* Convert letter to floor index */
2735 else if (command_wrk == USE_FLOOR)
2737 if (which == '(') k = 0;
2738 else if (which == ')') k = floor_num - 1;
2739 else k = islower(which) ? A2I(which) : -1;
2740 if (k < 0 || k >= floor_num || k >= 23)
2747 k = 0 - floor_list[k];
2750 /* Validate the item */
2751 if ((command_wrk != USE_FLOOR) && !get_item_okay(owner_ptr, k))
2757 /* Verify the item */
2758 if (ver && !verify(owner_ptr, _("本当に", "Try"), k))
2764 /* Allow player to "refuse" certain actions */
2765 if (!get_item_allow(owner_ptr, k))
2771 /* Accept that choice */
2780 /* Fix the screen if necessary */
2785 /* Hack -- Cancel "display" */
2786 command_see = FALSE;
2790 /* Forget the tval restriction */
2793 /* Forget the item_tester_hook restriction */
2794 item_tester_hook = NULL;
2797 /* Clean up 'show choices' */
2798 if (toggle) toggle_inventory_equipment(owner_ptr);
2800 owner_ptr->window |= (PW_INVEN | PW_EQUIP);
2801 handle_stuff(owner_ptr);
2803 /* Clear the prompt line */
2806 /* Warning if needed */
2807 if (oops && str) msg_print(str);
2812 if (command_cmd) prev_tag = cur_tag;
2813 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2819 * @brief 床上のアイテムを拾う選択用サブルーチン
2820 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
2822 static bool py_pickup_floor_aux(player_type *owner_ptr)
2824 OBJECT_IDX this_o_idx;
2828 /* Restrict the choices */
2829 item_tester_hook = inven_carry_okay;
2832 q = _("どれを拾いますか?", "Get which item? ");
2833 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
2835 if (choose_object(owner_ptr, &item, q, s, (USE_FLOOR), 0))
2837 this_o_idx = 0 - item;
2844 /* Pick up the object */
2845 py_pickup_aux(owner_ptr, this_o_idx);
2851 * @brief 床上のアイテムを拾うメイン処理
2852 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
2855 * This is called by py_pickup() when easy_floor is TRUE.
2857 void py_pickup_floor(player_type *owner_ptr, bool pickup)
2859 OBJECT_IDX this_o_idx, next_o_idx = 0;
2861 GAME_TEXT o_name[MAX_NLEN];
2865 OBJECT_IDX floor_o_idx = 0;
2869 /* Scan the pile of objects */
2870 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)
2872 /* Access the object */
2873 o_ptr = &owner_ptr->current_floor_ptr->o_list[this_o_idx];
2875 object_desc(owner_ptr, o_name, o_ptr, 0);
2877 /* Access the next object */
2878 next_o_idx = o_ptr->next_o_idx;
2880 disturb(owner_ptr, FALSE, FALSE);
2883 if (o_ptr->tval == TV_GOLD)
2886 msg_format(" $%ld の価値がある%sを見つけた。",
2887 (long)o_ptr->pval, o_name);
2889 msg_format("You have found %ld gold pieces worth of %s.",
2890 (long)o_ptr->pval, o_name);
2893 /* Collect the gold */
2894 owner_ptr->au += o_ptr->pval;
2897 owner_ptr->redraw |= (PR_GOLD);
2899 owner_ptr->window |= (PW_PLAYER);
2901 /* Delete the gold */
2902 delete_object_idx(owner_ptr, this_o_idx);
2904 /* Check the next object */
2907 else if (o_ptr->marked & OM_NOMSG)
2909 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
2910 * ignored. Otherwise, they are included in the prompt. */
2911 o_ptr->marked &= ~(OM_NOMSG);
2915 /* Count non-gold objects that can be picked up. */
2916 if (inven_carry_okay(o_ptr))
2921 /* Count non-gold objects */
2924 /* Remember this index */
2925 floor_o_idx = this_o_idx;
2928 /* There are no non-gold objects */
2932 /* Mention the number of objects */
2938 /* Access the object */
2939 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2940 object_desc(owner_ptr, o_name, o_ptr, 0);
2942 msg_format(_("%sがある。", "You see %s."), o_name);
2945 /* Multiple objects */
2948 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
2954 /* The player has no room for anything on the floor. */
2960 /* Access the object */
2961 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2962 object_desc(owner_ptr, o_name, o_ptr, 0);
2964 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
2967 /* Multiple objects */
2970 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
2979 while (can_pickup--)
2981 if (!py_pickup_floor_aux(owner_ptr)) break;
2987 /* Hack -- query every object */
2988 if (carry_query_flag)
2990 char out_val[MAX_NLEN + 20];
2992 /* Access the object */
2993 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
2994 object_desc(owner_ptr, o_name, o_ptr, 0);
2996 (void)sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
2998 /* Ask the user to confirm */
2999 if (!get_check(out_val))
3005 /* Access the object */
3006 o_ptr = &owner_ptr->current_floor_ptr->o_list[floor_o_idx];
3008 /* Pick up the object */
3009 py_pickup_aux(owner_ptr, floor_o_idx);
3014 * @brief 所持アイテム一覧を表示する /
3015 * Choice window "shadow" of the "show_inven()" function
3018 void display_inventory(player_type *owner_ptr, OBJECT_TYPE_VALUE tval)
3020 register int i, n, z = 0;
3022 TERM_COLOR attr = TERM_WHITE;
3024 GAME_TEXT o_name[MAX_NLEN];
3027 if (!owner_ptr || !owner_ptr->inventory_list) return;
3029 Term_get_size(&wid, &hgt);
3031 for (i = 0; i < INVEN_PACK; i++)
3033 o_ptr = &owner_ptr->inventory_list[i];
3034 if (!o_ptr->k_idx) continue;
3038 for (i = 0; i < z; i++)
3040 o_ptr = &owner_ptr->inventory_list[i];
3041 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3042 if (item_tester_okay(owner_ptr, o_ptr, tval))
3044 tmp_val[0] = index_to_label(i);
3048 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
3049 object_desc(owner_ptr, o_name, o_ptr, 0);
3051 attr = tval_to_attr[o_ptr->tval % 128];
3057 Term_putstr(3, i, n, attr, o_name);
3058 Term_erase(3 + n, i, 255);
3062 int wgt = o_ptr->weight * o_ptr->number;
3064 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3066 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3068 prt(tmp_val, i, wid - 9);
3072 for (i = z; i < hgt; i++)
3074 Term_erase(0, i, 255);
3080 * @brief 装備アイテムの表示を行う /
3081 * Display the equipment.
3082 * @param target_item アイテムの選択処理を行うか否か。
3083 * @return 選択したアイテムのタグ
3085 COMMAND_CODE show_equipment(player_type *owner_ptr, int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
3091 GAME_TEXT o_name[MAX_NLEN];
3092 COMMAND_CODE out_index[23];
3093 TERM_COLOR out_color[23];
3094 char out_desc[23][MAX_NLEN];
3095 COMMAND_CODE target_item_label = 0;
3097 char equip_label[52 + 1];
3099 /* Starting column */
3100 int col = command_gap;
3102 Term_get_size(&wid, &hgt);
3104 /* Maximal length */
3105 int len = wid - col - 1;
3107 /* Scan the equipment list */
3108 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3110 o_ptr = &owner_ptr->inventory_list[i];
3112 /* Is this item acceptable? */
3113 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL)) &&
3114 (!((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute) ||
3115 (mode & IGNORE_BOTHHAND_SLOT))) continue;
3117 object_desc(owner_ptr, o_name, o_ptr, 0);
3119 if ((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute)
3121 (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)"));
3122 out_color[k] = TERM_WHITE;
3126 (void)strcpy(out_desc[k], o_name);
3127 out_color[k] = tval_to_attr[o_ptr->tval % 128];
3131 /* Grey out charging items */
3134 out_color[k] = TERM_L_DARK;
3137 /* Extract the maximal length (see below) */
3139 l = strlen(out_desc[k]) + (2 + 1);
3141 l = strlen(out_desc[k]) + (2 + 3);
3145 /* Increase length for labels (if needed) */
3147 if (show_labels) l += (7 + 2);
3149 if (show_labels) l += (14 + 2);
3153 /* Increase length for weight (if needed) */
3154 if (show_weights) l += 9;
3156 if (show_item_graph) l += 2;
3158 /* Maintain the max-length */
3159 if (l > len) len = l;
3161 /* Advance the entry */
3165 /* Hack -- Find a column to start in */
3167 col = (len > wid - 6) ? 0 : (wid - len - 1);
3169 col = (len > wid - 4) ? 0 : (wid - len - 1);
3172 prepare_label_string(owner_ptr, equip_label, USE_EQUIP, tval);
3174 /* Output each entry */
3175 for (j = 0; j < k; j++)
3178 o_ptr = &owner_ptr->inventory_list[i];
3180 /* Clear the line */
3181 prt("", j + 1, col ? col - 2 : col);
3183 if (use_menu && target_item)
3185 if (j == (target_item - 1))
3187 strcpy(tmp_val, _("》", "> "));
3188 target_item_label = i;
3190 else strcpy(tmp_val, " ");
3192 else if (i >= INVEN_RARM)
3194 /* Prepare an index --(-- */
3195 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
3199 /* Prepare an index --(-- */
3200 sprintf(tmp_val, "%c)", index_to_label(i));
3203 /* Clear the line with the (possibly indented) index */
3204 put_str(tmp_val, j + 1, col);
3206 int cur_col = col + 3;
3208 /* Display graphics for object, if desired */
3209 if (show_item_graph)
3211 TERM_COLOR a = object_attr(o_ptr);
3212 SYMBOL_CODE c = object_char(o_ptr);
3213 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
3214 if (use_bigtile) cur_col++;
3222 /* Mention the use */
3223 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(owner_ptr, i));
3225 put_str(tmp_val, j + 1, cur_col);
3227 /* Display the entry itself */
3228 c_put_str(out_color[j], out_desc[j], j + 1, _(cur_col + 9, cur_col + 16));
3234 /* Display the entry itself */
3235 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
3238 /* Display the weight if needed */
3239 if (!show_weights) continue;
3241 int wgt = o_ptr->weight * o_ptr->number;
3243 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3245 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
3248 prt(tmp_val, j + 1, wid - 9);
3251 /* Make a "shadow" below the list (only if needed) */
3252 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3254 /* Save the new column */
3257 return target_item_label;
3262 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
3263 * Return a string describing how a given item is being worn.
3264 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
3265 * @return 状態表現内容の文字列ポインタ
3267 * Currently, only used for items in the equipment, inventory.
3269 concptr describe_use(player_type *owner_ptr, int i)
3275 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "運搬中の" : ((owner_ptr->ryoute && owner_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
3277 case INVEN_RARM: p = owner_ptr->heavy_wield[0] ? "just lifting" : (owner_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
3281 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "運搬中の" : ((owner_ptr->ryoute && owner_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
3283 case INVEN_LARM: p = owner_ptr->heavy_wield[1] ? "just lifting" : (owner_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
3286 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;
3287 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
3288 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
3289 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
3290 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
3291 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
3292 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
3293 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
3294 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
3295 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
3296 default: p = _("ザックに入っている", "carrying in your pack"); break;
3299 /* Return the result */