| 683 | | |
|---|
| 684 | | |
|---|
| 685 | | |
|---|
| 686 | | /* |
|---|
| 687 | | * Choice window "shadow" of the "show_inven()" function |
|---|
| 688 | | */ |
|---|
| 689 | | void display_inven(void) |
|---|
| 690 | | { |
|---|
| 691 | | register int i, n, z = 0; |
|---|
| 692 | | |
|---|
| 693 | | object_type *o_ptr; |
|---|
| 694 | | |
|---|
| 695 | | byte attr; |
|---|
| 696 | | |
|---|
| 697 | | char tmp_val[10]; |
|---|
| 698 | | |
|---|
| 699 | | char o_name[80]; |
|---|
| 700 | | |
|---|
| 701 | | |
|---|
| 702 | | /* Find the "final" slot */ |
|---|
| 703 | | for (i = 0; i < INVEN_PACK; i++) |
|---|
| 704 | | { |
|---|
| 705 | | o_ptr = &inventory[i]; |
|---|
| 706 | | |
|---|
| 707 | | /* Skip non-objects */ |
|---|
| 708 | | if (!o_ptr->k_idx) continue; |
|---|
| 709 | | |
|---|
| 710 | | /* Track */ |
|---|
| 711 | | z = i + 1; |
|---|
| 712 | | } |
|---|
| 713 | | |
|---|
| 714 | | /* Display the pack */ |
|---|
| 715 | | for (i = 0; i < z; i++) |
|---|
| 716 | | { |
|---|
| 717 | | /* Examine the item */ |
|---|
| 718 | | o_ptr = &inventory[i]; |
|---|
| 719 | | |
|---|
| 720 | | /* Start with an empty "index" */ |
|---|
| 721 | | tmp_val[0] = tmp_val[1] = tmp_val[2] = ' '; |
|---|
| 722 | | |
|---|
| 723 | | /* Is this item "acceptable"? */ |
|---|
| 724 | | if (item_tester_okay(o_ptr)) |
|---|
| 725 | | { |
|---|
| 726 | | /* Prepare an "index" */ |
|---|
| 727 | | tmp_val[0] = index_to_label(i); |
|---|
| 728 | | |
|---|
| 729 | | /* Bracket the "index" --(-- */ |
|---|
| 730 | | tmp_val[1] = ')'; |
|---|
| 731 | | } |
|---|
| 732 | | |
|---|
| 733 | | /* Display the index (or blank space) */ |
|---|
| 734 | | Term_putstr(0, i, 3, TERM_WHITE, tmp_val); |
|---|
| 735 | | |
|---|
| 736 | | /* Obtain an item description */ |
|---|
| 737 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 738 | | |
|---|
| 739 | | /* Obtain the length of the description */ |
|---|
| 740 | | n = strlen(o_name); |
|---|
| 741 | | |
|---|
| 742 | | /* Get inventory color */ |
|---|
| 743 | | attr = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 744 | | |
|---|
| 745 | | /* Display the entry itself */ |
|---|
| 746 | | Term_putstr(3, i, n, attr, o_name); |
|---|
| 747 | | |
|---|
| 748 | | /* Erase the rest of the line */ |
|---|
| 749 | | Term_erase(3+n, i, 255); |
|---|
| 750 | | |
|---|
| 751 | | /* Display the weight if needed */ |
|---|
| 752 | | if (o_ptr->weight) |
|---|
| 753 | | { |
|---|
| 754 | | int wgt = o_ptr->weight * o_ptr->number; |
|---|
| 755 | | strnfmt(tmp_val, sizeof(tmp_val), "%3d.%1d lb", wgt / 10, wgt % 10); |
|---|
| 756 | | Term_putstr(71, i, -1, TERM_WHITE, tmp_val); |
|---|
| 757 | | } |
|---|
| 758 | | } |
|---|
| 759 | | |
|---|
| 760 | | /* Erase the rest of the window */ |
|---|
| 761 | | for (i = z; i < Term->hgt; i++) |
|---|
| 762 | | { |
|---|
| 763 | | /* Erase the line */ |
|---|
| 764 | | Term_erase(0, i, 255); |
|---|
| 765 | | } |
|---|
| 766 | | } |
|---|
| 767 | | |
|---|
| 768 | | |
|---|
| 769 | | |
|---|
| 770 | | /* |
|---|
| 771 | | * Choice window "shadow" of the "show_equip()" function |
|---|
| 772 | | */ |
|---|
| 773 | | void display_equip(void) |
|---|
| 774 | | { |
|---|
| 775 | | register int i, n; |
|---|
| 776 | | object_type *o_ptr; |
|---|
| 777 | | byte attr; |
|---|
| 778 | | |
|---|
| 779 | | char tmp_val[10]; |
|---|
| 780 | | |
|---|
| 781 | | char o_name[80]; |
|---|
| 782 | | |
|---|
| 783 | | |
|---|
| 784 | | /* Display the equipment */ |
|---|
| 785 | | for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) |
|---|
| 786 | | { |
|---|
| 787 | | /* Examine the item */ |
|---|
| 788 | | o_ptr = &inventory[i]; |
|---|
| 789 | | |
|---|
| 790 | | /* Start with an empty "index" */ |
|---|
| 791 | | tmp_val[0] = tmp_val[1] = tmp_val[2] = ' '; |
|---|
| 792 | | |
|---|
| 793 | | /* Is this item "acceptable"? */ |
|---|
| 794 | | if (item_tester_okay(o_ptr)) |
|---|
| 795 | | { |
|---|
| 796 | | /* Prepare an "index" */ |
|---|
| 797 | | tmp_val[0] = index_to_label(i); |
|---|
| 798 | | |
|---|
| 799 | | /* Bracket the "index" --(-- */ |
|---|
| 800 | | tmp_val[1] = ')'; |
|---|
| 801 | | } |
|---|
| 802 | | |
|---|
| 803 | | /* Display the index (or blank space) */ |
|---|
| 804 | | Term_putstr(0, i - INVEN_WIELD, 3, TERM_WHITE, tmp_val); |
|---|
| 805 | | |
|---|
| 806 | | /* Obtain an item description */ |
|---|
| 807 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 808 | | |
|---|
| 809 | | /* Obtain the length of the description */ |
|---|
| 810 | | n = strlen(o_name); |
|---|
| 811 | | |
|---|
| 812 | | /* Get inventory color */ |
|---|
| 813 | | attr = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 814 | | |
|---|
| 815 | | /* Display the entry itself */ |
|---|
| 816 | | Term_putstr(3, i - INVEN_WIELD, n, attr, o_name); |
|---|
| 817 | | |
|---|
| 818 | | /* Erase the rest of the line */ |
|---|
| 819 | | Term_erase(3+n, i - INVEN_WIELD, 255); |
|---|
| 820 | | |
|---|
| 821 | | /* Display the slot description (if needed) */ |
|---|
| 822 | | if (show_labels) |
|---|
| 823 | | { |
|---|
| 824 | | Term_putstr(61, i - INVEN_WIELD, -1, TERM_WHITE, "<--"); |
|---|
| 825 | | Term_putstr(65, i - INVEN_WIELD, -1, TERM_WHITE, mention_use(i)); |
|---|
| 826 | | } |
|---|
| 827 | | |
|---|
| 828 | | /* Display the weight (if needed) */ |
|---|
| 829 | | if (o_ptr->weight) |
|---|
| 830 | | { |
|---|
| 831 | | int wgt = o_ptr->weight * o_ptr->number; |
|---|
| 832 | | int col = (show_labels ? 52 : 71); |
|---|
| 833 | | strnfmt(tmp_val, sizeof(tmp_val), "%3d.%1d lb", wgt / 10, wgt % 10); |
|---|
| 834 | | Term_putstr(col, i - INVEN_WIELD, -1, TERM_WHITE, tmp_val); |
|---|
| 835 | | } |
|---|
| 836 | | } |
|---|
| 837 | | |
|---|
| 838 | | /* Erase the rest of the window */ |
|---|
| 839 | | for (i = INVEN_TOTAL - INVEN_WIELD; i < Term->hgt; i++) |
|---|
| 840 | | { |
|---|
| 841 | | /* Clear that line */ |
|---|
| 842 | | Term_erase(0, i, 255); |
|---|
| 843 | | } |
|---|
| 844 | | } |
|---|
| 845 | | |
|---|
| 846 | | |
|---|
| 847 | | |
|---|
| 848 | | /* |
|---|
| 849 | | * Display the inventory. |
|---|
| 850 | | * |
|---|
| 851 | | * Hack -- do not display "trailing" empty slots |
|---|
| 852 | | */ |
|---|
| 853 | | void show_inven(void) |
|---|
| 854 | | { |
|---|
| 855 | | int i, j, k, l, z = 0; |
|---|
| 856 | | int col, len, lim; |
|---|
| 857 | | |
|---|
| 858 | | object_type *o_ptr; |
|---|
| 859 | | |
|---|
| 860 | | char o_name[80]; |
|---|
| 861 | | |
|---|
| 862 | | char tmp_val[80]; |
|---|
| 863 | | |
|---|
| 864 | | int out_index[24]; |
|---|
| 865 | | byte out_color[24]; |
|---|
| 866 | | char out_desc[24][80]; |
|---|
| 867 | | |
|---|
| 868 | | |
|---|
| 869 | | /* Default length */ |
|---|
| 870 | | len = 79 - 50; |
|---|
| 871 | | |
|---|
| 872 | | /* Maximum space allowed for descriptions */ |
|---|
| 873 | | /* screen width - "a) " - weight */ |
|---|
| 874 | | lim = 79 - 3 - 9; |
|---|
| 875 | | |
|---|
| 876 | | |
|---|
| 877 | | /* Find the "final" slot */ |
|---|
| 878 | | for (i = 0; i < INVEN_PACK; i++) |
|---|
| 879 | | { |
|---|
| 880 | | o_ptr = &inventory[i]; |
|---|
| 881 | | |
|---|
| 882 | | /* Skip non-objects */ |
|---|
| 883 | | if (!o_ptr->k_idx) continue; |
|---|
| 884 | | |
|---|
| 885 | | /* Track */ |
|---|
| 886 | | z = i + 1; |
|---|
| 887 | | } |
|---|
| 888 | | |
|---|
| 889 | | /* Display the inventory */ |
|---|
| 890 | | for (k = 0, i = 0; i < z; i++) |
|---|
| 891 | | { |
|---|
| 892 | | o_ptr = &inventory[i]; |
|---|
| 893 | | |
|---|
| 894 | | /* Is this item acceptable? */ |
|---|
| 895 | | if (!item_tester_okay(o_ptr)) continue; |
|---|
| 896 | | |
|---|
| 897 | | /* Describe the object */ |
|---|
| 898 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 899 | | |
|---|
| 900 | | /* Hack -- enforce max length */ |
|---|
| 901 | | o_name[lim] = '\0'; |
|---|
| 902 | | |
|---|
| 903 | | /* Save the index */ |
|---|
| 904 | | out_index[k] = i; |
|---|
| 905 | | |
|---|
| 906 | | /* Get inventory color */ |
|---|
| 907 | | out_color[k] = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 908 | | |
|---|
| 909 | | /* Save the object description */ |
|---|
| 910 | | my_strcpy(out_desc[k], o_name, sizeof(out_desc[0])); |
|---|
| 911 | | |
|---|
| 912 | | /* Find the predicted "line length" */ |
|---|
| 913 | | l = strlen(out_desc[k]) + 5; |
|---|
| 914 | | |
|---|
| 915 | | /* Be sure to account for the weight */ |
|---|
| 916 | | l += 9; |
|---|
| 917 | | |
|---|
| 918 | | /* Maintain the maximum length */ |
|---|
| 919 | | if (l > len) len = l; |
|---|
| 920 | | |
|---|
| 921 | | /* Advance to next "line" */ |
|---|
| 922 | | k++; |
|---|
| 923 | | } |
|---|
| 924 | | |
|---|
| 925 | | /* Find the column to start in */ |
|---|
| 926 | | col = (len > 76) ? 0 : (79 - len); |
|---|
| 927 | | |
|---|
| 928 | | /* Output each entry */ |
|---|
| 929 | | for (j = 0; j < k; j++) |
|---|
| 930 | | { |
|---|
| 931 | | int wgt; |
|---|
| 932 | | |
|---|
| 933 | | /* Get the index */ |
|---|
| 934 | | i = out_index[j]; |
|---|
| 935 | | |
|---|
| 936 | | /* Get the item */ |
|---|
| 937 | | o_ptr = &inventory[i]; |
|---|
| 938 | | |
|---|
| 939 | | /* Clear the line */ |
|---|
| 940 | | prt("", j + 1, col ? col - 2 : col); |
|---|
| 941 | | |
|---|
| 942 | | /* Prepare an index --(-- */ |
|---|
| 943 | | strnfmt(tmp_val, sizeof(tmp_val), "%c)", index_to_label(i)); |
|---|
| 944 | | |
|---|
| 945 | | /* Clear the line with the (possibly indented) index */ |
|---|
| 946 | | put_str(tmp_val, j + 1, col); |
|---|
| 947 | | |
|---|
| 948 | | /* Display the entry itself */ |
|---|
| 949 | | c_put_str(out_color[j], out_desc[j], j + 1, col + 3); |
|---|
| 950 | | |
|---|
| 951 | | /* Display the weight if needed */ |
|---|
| 952 | | wgt = o_ptr->weight * o_ptr->number; |
|---|
| 953 | | strnfmt(tmp_val, sizeof(tmp_val), "%3d.%1d lb", wgt / 10, wgt % 10); |
|---|
| 954 | | put_str(tmp_val, j + 1, 71); |
|---|
| 955 | | } |
|---|
| 956 | | |
|---|
| 957 | | /* Make a "shadow" below the list (only if needed) */ |
|---|
| 958 | | if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); |
|---|
| 959 | | } |
|---|
| 960 | | |
|---|
| 961 | | |
|---|
| 962 | | /* |
|---|
| 963 | | * Display the equipment. |
|---|
| 964 | | */ |
|---|
| 965 | | void show_equip(void) |
|---|
| 966 | | { |
|---|
| 967 | | int i, j, k, l; |
|---|
| 968 | | int col, len, lim; |
|---|
| 969 | | |
|---|
| 970 | | object_type *o_ptr; |
|---|
| 971 | | |
|---|
| 972 | | char tmp_val[80]; |
|---|
| 973 | | |
|---|
| 974 | | char o_name[80]; |
|---|
| 975 | | |
|---|
| 976 | | int out_index[24]; |
|---|
| 977 | | byte out_color[24]; |
|---|
| 978 | | char out_desc[24][80]; |
|---|
| 979 | | |
|---|
| 980 | | |
|---|
| 981 | | /* Default length */ |
|---|
| 982 | | len = 79 - 50; |
|---|
| 983 | | |
|---|
| 984 | | /* Maximum space allowed for descriptions */ |
|---|
| 985 | | lim = 79 - 3; |
|---|
| 986 | | |
|---|
| 987 | | /* Require space for labels (if needed) */ |
|---|
| 988 | | if (show_labels) lim -= (14 + 2); |
|---|
| 989 | | |
|---|
| 990 | | /* Require space for weight */ |
|---|
| 991 | | lim -= 9; |
|---|
| 992 | | |
|---|
| 993 | | /* Scan the equipment list */ |
|---|
| 994 | | for (k = 0, i = INVEN_WIELD; i < INVEN_TOTAL; i++) |
|---|
| 995 | | { |
|---|
| 996 | | o_ptr = &inventory[i]; |
|---|
| 997 | | |
|---|
| 998 | | /* Is this item acceptable? */ |
|---|
| 999 | | if (!item_tester_okay(o_ptr)) continue; |
|---|
| 1000 | | |
|---|
| 1001 | | /* Description */ |
|---|
| 1002 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 1003 | | |
|---|
| 1004 | | /* Truncate the description */ |
|---|
| 1005 | | o_name[lim] = 0; |
|---|
| 1006 | | |
|---|
| 1007 | | /* Save the index */ |
|---|
| 1008 | | out_index[k] = i; |
|---|
| 1009 | | |
|---|
| 1010 | | /* Get inventory color */ |
|---|
| 1011 | | out_color[k] = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 1012 | | |
|---|
| 1013 | | /* Save the description */ |
|---|
| 1014 | | my_strcpy(out_desc[k], o_name, sizeof(out_desc[0])); |
|---|
| 1015 | | |
|---|
| 1016 | | /* Extract the maximal length (see below) */ |
|---|
| 1017 | | l = strlen(out_desc[k]) + (2 + 3); |
|---|
| 1018 | | |
|---|
| 1019 | | /* Increase length for labels (if needed) */ |
|---|
| 1020 | | if (show_labels) l += (14 + 2); |
|---|
| 1021 | | |
|---|
| 1022 | | /* Increase length for weight */ |
|---|
| 1023 | | l += 9; |
|---|
| 1024 | | |
|---|
| 1025 | | /* Maintain the max-length */ |
|---|
| 1026 | | if (l > len) len = l; |
|---|
| 1027 | | |
|---|
| 1028 | | /* Advance the entry */ |
|---|
| 1029 | | k++; |
|---|
| 1030 | | } |
|---|
| 1031 | | |
|---|
| 1032 | | /* Hack -- Find a column to start in */ |
|---|
| 1033 | | col = (len > 76) ? 0 : (79 - len); |
|---|
| 1034 | | |
|---|
| 1035 | | /* Output each entry */ |
|---|
| 1036 | | for (j = 0; j < k; j++) |
|---|
| 1037 | | { |
|---|
| 1038 | | int wgt; |
|---|
| 1039 | | |
|---|
| 1040 | | /* Get the index */ |
|---|
| 1041 | | i = out_index[j]; |
|---|
| 1042 | | |
|---|
| 1043 | | /* Get the item */ |
|---|
| 1044 | | o_ptr = &inventory[i]; |
|---|
| 1045 | | |
|---|
| 1046 | | /* Clear the line */ |
|---|
| 1047 | | prt("", j + 1, col ? col - 2 : col); |
|---|
| 1048 | | |
|---|
| 1049 | | /* Prepare an index --(-- */ |
|---|
| 1050 | | strnfmt(tmp_val, sizeof(tmp_val), "%c)", index_to_label(i)); |
|---|
| 1051 | | |
|---|
| 1052 | | /* Clear the line with the (possibly indented) index */ |
|---|
| 1053 | | put_str(tmp_val, j+1, col); |
|---|
| 1054 | | |
|---|
| 1055 | | /* Use labels */ |
|---|
| 1056 | | if (show_labels) |
|---|
| 1057 | | { |
|---|
| 1058 | | /* Mention the use */ |
|---|
| 1059 | | strnfmt(tmp_val, sizeof(tmp_val), "%-14s: ", mention_use(i)); |
|---|
| 1060 | | put_str(tmp_val, j+1, col + 3); |
|---|
| 1061 | | |
|---|
| 1062 | | /* Display the entry itself */ |
|---|
| 1063 | | c_put_str(out_color[j], out_desc[j], j+1, col + 3 + 14 + 2); |
|---|
| 1064 | | } |
|---|
| 1065 | | |
|---|
| 1066 | | /* No labels */ |
|---|
| 1067 | | else |
|---|
| 1068 | | { |
|---|
| 1069 | | /* Display the entry itself */ |
|---|
| 1070 | | c_put_str(out_color[j], out_desc[j], j+1, col + 3); |
|---|
| 1071 | | } |
|---|
| 1072 | | |
|---|
| 1073 | | /* Display the weight if needed */ |
|---|
| 1074 | | wgt = o_ptr->weight * o_ptr->number; |
|---|
| 1075 | | strnfmt(tmp_val, sizeof(tmp_val), "%3d.%d lb", wgt / 10, wgt % 10); |
|---|
| 1076 | | put_str(tmp_val, j+1, 71); |
|---|
| 1077 | | } |
|---|
| 1078 | | |
|---|
| 1079 | | /* Make a "shadow" below the list (only if needed) */ |
|---|
| 1080 | | if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); |
|---|
| 1081 | | } |
|---|
| 1082 | | |
|---|
| 1083 | | |
|---|
| 1084 | | /* |
|---|
| 1085 | | * Display a list of the items on the floor at the given location. -TNB- |
|---|
| 1086 | | */ |
|---|
| 1087 | | void show_floor(const int *floor_list, int floor_num, bool gold) |
|---|
| 1088 | | { |
|---|
| 1089 | | int i, j, k, l; |
|---|
| 1090 | | int col, len, lim; |
|---|
| 1091 | | |
|---|
| 1092 | | object_type *o_ptr; |
|---|
| 1093 | | |
|---|
| 1094 | | char o_name[80]; |
|---|
| 1095 | | |
|---|
| 1096 | | char tmp_val[80]; |
|---|
| 1097 | | |
|---|
| 1098 | | int out_index[MAX_FLOOR_STACK]; |
|---|
| 1099 | | byte out_color[MAX_FLOOR_STACK]; |
|---|
| 1100 | | char out_desc[MAX_FLOOR_STACK][80]; |
|---|
| 1101 | | |
|---|
| 1102 | | |
|---|
| 1103 | | /* Default length */ |
|---|
| 1104 | | len = 79 - 50; |
|---|
| 1105 | | |
|---|
| 1106 | | /* Maximum space allowed for descriptions */ |
|---|
| 1107 | | lim = 79 - 3; |
|---|
| 1108 | | |
|---|
| 1109 | | /* Require space for weight */ |
|---|
| 1110 | | lim -= 9; |
|---|
| 1111 | | |
|---|
| 1112 | | /* Limit displayed floor items to 23 (screen limits) */ |
|---|
| 1113 | | if (floor_num > MAX_FLOOR_STACK) floor_num = MAX_FLOOR_STACK; |
|---|
| 1114 | | |
|---|
| 1115 | | /* Display the floor */ |
|---|
| 1116 | | for (k = 0, i = 0; i < floor_num; i++) |
|---|
| 1117 | | { |
|---|
| 1118 | | o_ptr = &o_list[floor_list[i]]; |
|---|
| 1119 | | |
|---|
| 1120 | | /* Optionally, show gold */ |
|---|
| 1121 | | if ((o_ptr->tval != TV_GOLD) || (!gold)) |
|---|
| 1122 | | { |
|---|
| 1123 | | /* Is this item acceptable? (always rejects gold) */ |
|---|
| 1124 | | if (!item_tester_okay(o_ptr)) continue; |
|---|
| 1125 | | } |
|---|
| 1126 | | |
|---|
| 1127 | | /* Describe the object */ |
|---|
| 1128 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 1129 | | |
|---|
| 1130 | | /* Hack -- enforce max length */ |
|---|
| 1131 | | o_name[lim] = '\0'; |
|---|
| 1132 | | |
|---|
| 1133 | | /* Save the index */ |
|---|
| 1134 | | out_index[k] = i; |
|---|
| 1135 | | |
|---|
| 1136 | | /* Get inventory color */ |
|---|
| 1137 | | out_color[k] = tval_to_attr[o_ptr->tval % N_ELEMENTS(tval_to_attr)]; |
|---|
| 1138 | | |
|---|
| 1139 | | /* Save the object description */ |
|---|
| 1140 | | my_strcpy(out_desc[k], o_name, sizeof(out_desc[0])); |
|---|
| 1141 | | |
|---|
| 1142 | | /* Find the predicted "line length" */ |
|---|
| 1143 | | l = strlen(out_desc[k]) + 5; |
|---|
| 1144 | | |
|---|
| 1145 | | /* Be sure to account for the weight */ |
|---|
| 1146 | | l += 9; |
|---|
| 1147 | | |
|---|
| 1148 | | /* Maintain the maximum length */ |
|---|
| 1149 | | if (l > len) len = l; |
|---|
| 1150 | | |
|---|
| 1151 | | /* Advance to next "line" */ |
|---|
| 1152 | | k++; |
|---|
| 1153 | | } |
|---|
| 1154 | | |
|---|
| 1155 | | /* Find the column to start in */ |
|---|
| 1156 | | col = (len > 76) ? 0 : (79 - len); |
|---|
| 1157 | | |
|---|
| 1158 | | /* Output each entry */ |
|---|
| 1159 | | for (j = 0; j < k; j++) |
|---|
| 1160 | | { |
|---|
| 1161 | | int wgt; |
|---|
| 1162 | | |
|---|
| 1163 | | /* Get the index */ |
|---|
| 1164 | | i = floor_list[out_index[j]]; |
|---|
| 1165 | | |
|---|
| 1166 | | /* Get the item */ |
|---|
| 1167 | | o_ptr = &o_list[i]; |
|---|
| 1168 | | |
|---|
| 1169 | | /* Clear the line */ |
|---|
| 1170 | | prt("", j + 1, col ? col - 2 : col); |
|---|
| 1171 | | |
|---|
| 1172 | | /* Prepare an index --(-- */ |
|---|
| 1173 | | strnfmt(tmp_val, sizeof(tmp_val), "%c)", index_to_label(out_index[j])); |
|---|
| 1174 | | |
|---|
| 1175 | | /* Clear the line with the (possibly indented) index */ |
|---|
| 1176 | | put_str(tmp_val, j + 1, col); |
|---|
| 1177 | | |
|---|
| 1178 | | /* Display the entry itself */ |
|---|
| 1179 | | c_put_str(out_color[j], out_desc[j], j + 1, col + 3); |
|---|
| 1180 | | |
|---|
| 1181 | | /* Display the weight if needed */ |
|---|
| 1182 | | wgt = o_ptr->weight * o_ptr->number; |
|---|
| 1183 | | strnfmt(tmp_val, sizeof(tmp_val), "%3d.%1d lb", wgt / 10, wgt % 10); |
|---|
| 1184 | | put_str(tmp_val, j + 1, 71); |
|---|
| 1185 | | } |
|---|
| 1186 | | |
|---|
| 1187 | | /* Make a "shadow" below the list (only if needed) */ |
|---|
| 1188 | | if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); |
|---|
| 1189 | | } |
|---|
| 1190 | | |
|---|
| 1191 | | |
|---|
| 1192 | | |
|---|
| 1193 | | /* |
|---|
| 1194 | | * Verify the choice of an item. |
|---|
| 1195 | | * |
|---|
| 1196 | | * The item can be negative to mean "item on floor". |
|---|
| 1197 | | */ |
|---|
| 1198 | | bool verify_item(cptr prompt, int item) |
|---|
| 1199 | | { |
|---|
| 1200 | | char o_name[80]; |
|---|
| 1201 | | |
|---|
| 1202 | | char out_val[160]; |
|---|
| 1203 | | |
|---|
| 1204 | | object_type *o_ptr; |
|---|
| 1205 | | |
|---|
| 1206 | | /* Inventory */ |
|---|
| 1207 | | if (item >= 0) |
|---|
| 1208 | | { |
|---|
| 1209 | | o_ptr = &inventory[item]; |
|---|
| 1210 | | } |
|---|
| 1211 | | |
|---|
| 1212 | | /* Floor */ |
|---|
| 1213 | | else |
|---|
| 1214 | | { |
|---|
| 1215 | | o_ptr = &o_list[0 - item]; |
|---|
| 1216 | | } |
|---|
| 1217 | | |
|---|
| 1218 | | /* Describe */ |
|---|
| 1219 | | object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 1220 | | |
|---|
| 1221 | | /* Prompt */ |
|---|
| 1222 | | strnfmt(out_val, sizeof(out_val), "%s %s? ", prompt, o_name); |
|---|
| 1223 | | |
|---|
| 1224 | | /* Query */ |
|---|
| 1225 | | return (get_check(out_val)); |
|---|
| 1226 | | } |
|---|
| 1227 | | |
|---|
| 1228 | | |
|---|
| 1229 | | /* |
|---|
| 1230 | | * Hack -- allow user to "prevent" certain choices. |
|---|
| 1231 | | * |
|---|
| 1232 | | * The item can be negative to mean "item on floor". |
|---|
| 1233 | | */ |
|---|
| 1234 | | static bool get_item_allow(int item) |
|---|
| 1235 | | { |
|---|
| 1236 | | object_type *o_ptr; |
|---|
| 1237 | | char verify_inscrip[] = "!*"; |
|---|
| 1238 | | |
|---|
| 1239 | | /* Inventory */ |
|---|
| 1240 | | if (item >= 0) |
|---|
| 1241 | | { |
|---|
| 1242 | | o_ptr = &inventory[item]; |
|---|
| 1243 | | } |
|---|
| 1244 | | |
|---|
| 1245 | | /* Floor */ |
|---|
| 1246 | | else |
|---|
| 1247 | | { |
|---|
| 1248 | | o_ptr = &o_list[0 - item]; |
|---|
| 1249 | | } |
|---|
| 1250 | | |
|---|
| 1251 | | /* Check for a "prevention" inscription */ |
|---|
| 1252 | | verify_inscrip[1] = p_ptr->command_cmd; |
|---|
| 1253 | | |
|---|
| 1254 | | if (o_ptr->note && (check_for_inscrip(o_ptr, "!*") || |
|---|
| 1255 | | check_for_inscrip(o_ptr, verify_inscrip))) |
|---|
| 1256 | | { |
|---|
| 1257 | | /* Verify the choice */ |
|---|
| 1258 | | if (!verify_item("Really try", item)) return (FALSE); |
|---|
| 1259 | | } |
|---|
| 1260 | | |
|---|
| 1261 | | /* Allow it */ |
|---|
| 1262 | | return (TRUE); |
|---|
| 1263 | | } |
|---|
| 1264 | | |
|---|
| 1265 | | |
|---|
| 1266 | | /* |
|---|
| 1267 | | * Verify the "okayness" of a given item. |
|---|
| 1268 | | * |
|---|
| 1269 | | * The item can be negative to mean "item on floor". |
|---|
| 1270 | | */ |
|---|
| 1271 | | static bool get_item_okay(int item) |
|---|
| 1272 | | { |
|---|
| 1273 | | object_type *o_ptr; |
|---|
| 1274 | | |
|---|
| 1275 | | /* Inventory */ |
|---|
| 1276 | | if (item >= 0) |
|---|
| 1277 | | { |
|---|
| 1278 | | o_ptr = &inventory[item]; |
|---|
| 1279 | | } |
|---|
| 1280 | | |
|---|
| 1281 | | /* Floor */ |
|---|
| 1282 | | else |
|---|
| 1283 | | { |
|---|
| 1284 | | o_ptr = &o_list[0 - item]; |
|---|
| 1285 | | } |
|---|
| 1286 | | |
|---|
| 1287 | | /* Verify the item */ |
|---|
| 1288 | | return (item_tester_okay(o_ptr)); |
|---|
| 1289 | | } |
|---|
| 1290 | | |
|---|
| 1291 | | |
|---|
| 1292 | | |
|---|
| 1293 | | /* |
|---|
| 1294 | | * Find the "first" inventory object with the given "tag". |
|---|
| 1295 | | * |
|---|
| 1296 | | * A "tag" is a char "n" appearing as "@n" anywhere in the |
|---|
| 1297 | | * inscription of an object. |
|---|
| 1298 | | * |
|---|
| 1299 | | * Also, the tag "@xn" will work as well, where "n" is a tag-char, |
|---|
| 1300 | | * and "x" is the "current" p_ptr->command_cmd code. |
|---|
| 1301 | | */ |
|---|
| 1302 | | static int get_tag(int *cp, char tag) |
|---|
| 1303 | | { |
|---|
| 1304 | | int i; |
|---|
| 1305 | | cptr s; |
|---|
| 1306 | | |
|---|
| 1307 | | |
|---|
| 1308 | | /* Check every object */ |
|---|
| 1309 | | for (i = 0; i < INVEN_TOTAL; ++i) |
|---|
| 1310 | | { |
|---|
| 1311 | | object_type *o_ptr = &inventory[i]; |
|---|
| 1312 | | |
|---|
| 1313 | | /* Skip non-objects */ |
|---|
| 1314 | | if (!o_ptr->k_idx) continue; |
|---|
| 1315 | | |
|---|
| 1316 | | /* Skip empty inscriptions */ |
|---|
| 1317 | | if (!o_ptr->note) continue; |
|---|
| 1318 | | |
|---|
| 1319 | | /* Find a '@' */ |
|---|
| 1320 | | s = strchr(quark_str(o_ptr->note), '@'); |
|---|
| 1321 | | |
|---|
| 1322 | | /* Process all tags */ |
|---|
| 1323 | | while (s) |
|---|
| 1324 | | { |
|---|
| 1325 | | /* Check the normal tags */ |
|---|
| 1326 | | if (s[1] == tag) |
|---|
| 1327 | | { |
|---|
| 1328 | | /* Save the actual inventory ID */ |
|---|
| 1329 | | *cp = i; |
|---|
| 1330 | | |
|---|
| 1331 | | /* Success */ |
|---|
| 1332 | | return (TRUE); |
|---|
| 1333 | | } |
|---|
| 1334 | | |
|---|
| 1335 | | /* Check the special tags */ |
|---|
| 1336 | | if ((s[1] == p_ptr->command_cmd) && (s[2] == tag)) |
|---|
| 1337 | | { |
|---|
| 1338 | | /* Save the actual inventory ID */ |
|---|
| 1339 | | *cp = i; |
|---|
| 1340 | | |
|---|
| 1341 | | /* Success */ |
|---|
| 1342 | | return (TRUE); |
|---|
| 1343 | | } |
|---|
| 1344 | | |
|---|
| 1345 | | /* Find another '@' */ |
|---|
| 1346 | | s = strchr(s + 1, '@'); |
|---|
| 1347 | | } |
|---|
| 1348 | | } |
|---|
| 1349 | | |
|---|
| 1350 | | /* No such tag */ |
|---|
| 1351 | | return (FALSE); |
|---|
| 1352 | | } |
|---|
| 1353 | | |
|---|
| 1354 | | |
|---|
| 1355 | | |
|---|
| 1356 | | /* |
|---|
| 1357 | | * Let the user select an item, save its "index" |
|---|
| 1358 | | * |
|---|
| 1359 | | * Return TRUE only if an acceptable item was chosen by the user. |
|---|
| 1360 | | * |
|---|
| 1361 | | * The selected item must satisfy the "item_tester_hook()" function, |
|---|
| 1362 | | * if that hook is set, and the "item_tester_tval", if that value is set. |
|---|
| 1363 | | * |
|---|
| 1364 | | * All "item_tester" restrictions are cleared before this function returns. |
|---|
| 1365 | | * |
|---|
| 1366 | | * The user is allowed to choose acceptable items from the equipment, |
|---|
| 1367 | | * inventory, or floor, respectively, if the proper flag was given, |
|---|
| 1368 | | * and there are any acceptable items in that location. |
|---|
| 1369 | | * |
|---|
| 1370 | | * The equipment or inventory are displayed (even if no acceptable |
|---|
| 1371 | | * items are in that location) if the proper flag was given. |
|---|
| 1372 | | * |
|---|
| 1373 | | * If there are no acceptable items available anywhere, and "str" is |
|---|
| 1374 | | * not NULL, then it will be used as the text of a warning message |
|---|
| 1375 | | * before the function returns. |
|---|
| 1376 | | * |
|---|
| 1377 | | * Note that the user must press "-" to specify the item on the floor, |
|---|
| 1378 | | * and there is no way to "examine" the item on the floor, while the |
|---|
| 1379 | | * use of "capital" letters will "examine" an inventory/equipment item, |
|---|
| 1380 | | * and prompt for its use. |
|---|
| 1381 | | * |
|---|
| 1382 | | * If a legal item is selected from the inventory, we save it in "cp" |
|---|
| 1383 | | * directly (0 to 35), and return TRUE. |
|---|
| 1384 | | * |
|---|
| 1385 | | * If a legal item is selected from the floor, we save it in "cp" as |
|---|
| 1386 | | * a negative (-1 to -511), and return TRUE. |
|---|
| 1387 | | * |
|---|
| 1388 | | * If no item is available, we do nothing to "cp", and we display a |
|---|
| 1389 | | * warning message, using "str" if available, and return FALSE. |
|---|
| 1390 | | * |
|---|
| 1391 | | * If no item is selected, we do nothing to "cp", and return FALSE. |
|---|
| 1392 | | * |
|---|
| 1393 | | * Global "p_ptr->command_new" is used when viewing the inventory or equipment |
|---|
| 1394 | | * to allow the user to enter a command while viewing those screens, and |
|---|
| 1395 | | * also to induce "auto-enter" of stores, and other such stuff. |
|---|
| 1396 | | * |
|---|
| 1397 | | * Global "p_ptr->command_see" may be set before calling this function to start |
|---|
| 1398 | | * out in "browse" mode. It is cleared before this function returns. |
|---|
| 1399 | | * |
|---|
| 1400 | | * Global "p_ptr->command_wrk" is used to choose between equip/inven/floor |
|---|
| 1401 | | * listings. It is equal to USE_INVEN or USE_EQUIP or USE_FLOOR, except |
|---|
| 1402 | | * when this function is first called, when it is equal to zero, which will |
|---|
| 1403 | | * cause it to be set to USE_INVEN. |
|---|
| 1404 | | * |
|---|
| 1405 | | * We always erase the prompt when we are done, leaving a blank line, |
|---|
| 1406 | | * or a warning message, if appropriate, if no items are available. |
|---|
| 1407 | | * |
|---|
| 1408 | | * Note that only "acceptable" floor objects get indexes, so between two |
|---|
| 1409 | | * commands, the indexes of floor objects may change. XXX XXX XXX |
|---|
| 1410 | | */ |
|---|
| 1411 | | bool get_item(int *cp, cptr pmt, cptr str, int mode) |
|---|
| 1412 | | { |
|---|
| 1413 | | int py = p_ptr->py; |
|---|
| 1414 | | int px = p_ptr->px; |
|---|
| 1415 | | |
|---|
| 1416 | | char which; |
|---|
| 1417 | | |
|---|
| 1418 | | int j, k; |
|---|
| 1419 | | |
|---|
| 1420 | | int i1, i2; |
|---|
| 1421 | | int e1, e2; |
|---|
| 1422 | | int f1, f2; |
|---|
| 1423 | | |
|---|
| 1424 | | bool done, item; |
|---|
| 1425 | | |
|---|
| 1426 | | bool oops = FALSE; |
|---|
| 1427 | | |
|---|
| 1428 | | bool use_inven = ((mode & USE_INVEN) ? TRUE : FALSE); |
|---|
| 1429 | | bool use_equip = ((mode & USE_EQUIP) ? TRUE : FALSE); |
|---|
| 1430 | | bool use_floor = ((mode & USE_FLOOR) ? TRUE : FALSE); |
|---|
| 1431 | | bool can_squelch = ((mode & CAN_SQUELCH) ? TRUE : FALSE); |
|---|
| 1432 | | |
|---|
| 1433 | | bool allow_inven = FALSE; |
|---|
| 1434 | | bool allow_equip = FALSE; |
|---|
| 1435 | | bool allow_floor = FALSE; |
|---|
| 1436 | | |
|---|
| 1437 | | bool toggle = FALSE; |
|---|
| 1438 | | |
|---|
| 1439 | | char tmp_val[160]; |
|---|
| 1440 | | char out_val[160]; |
|---|
| 1441 | | |
|---|
| 1442 | | int floor_list[MAX_FLOOR_STACK]; |
|---|
| 1443 | | int floor_num; |
|---|
| 1444 | | |
|---|
| 1445 | | |
|---|
| 1446 | | /* Always show lists */ |
|---|
| 1447 | | if (OPT(show_lists)) p_ptr->command_see = TRUE; |
|---|
| 1448 | | |
|---|
| 1449 | | |
|---|
| 1450 | | /* Get the item index */ |
|---|
| 1451 | | if (repeat_pull(cp)) |
|---|
| 1452 | | { |
|---|
| 1453 | | /* Verify the item */ |
|---|
| 1454 | | if (get_item_okay(*cp)) |
|---|
| 1455 | | { |
|---|
| 1456 | | /* Forget the item_tester_tval restriction */ |
|---|
| 1457 | | item_tester_tval = 0; |
|---|
| 1458 | | |
|---|
| 1459 | | /* Forget the item_tester_hook restriction */ |
|---|
| 1460 | | item_tester_hook = NULL; |
|---|
| 1461 | | |
|---|
| 1462 | | /* Success */ |
|---|
| 1463 | | return (TRUE); |
|---|
| 1464 | | } |
|---|
| 1465 | | else |
|---|
| 1466 | | { |
|---|
| 1467 | | /* Invalid repeat - reset it */ |
|---|
| 1468 | | repeat_clear(); |
|---|
| 1469 | | } |
|---|
| 1470 | | } |
|---|
| 1471 | | |
|---|
| 1472 | | |
|---|
| 1473 | | /* Paranoia XXX XXX XXX */ |
|---|
| 1474 | | message_flush(); |
|---|
| 1475 | | |
|---|
| 1476 | | |
|---|
| 1477 | | /* Not done */ |
|---|
| 1478 | | done = FALSE; |
|---|
| 1479 | | |
|---|
| 1480 | | /* No item selected */ |
|---|
| 1481 | | item = FALSE; |
|---|
| 1482 | | |
|---|
| 1483 | | |
|---|
| 1484 | | /* Full inventory */ |
|---|
| 1485 | | i1 = 0; |
|---|
| 1486 | | i2 = INVEN_PACK - 1; |
|---|
| 1487 | | |
|---|
| 1488 | | /* Forbid inventory */ |
|---|
| 1489 | | if (!use_inven) i2 = -1; |
|---|
| 1490 | | |
|---|
| 1491 | | /* Restrict inventory indexes */ |
|---|
| 1492 | | while ((i1 <= i2) && (!get_item_okay(i1))) i1++; |
|---|
| 1493 | | while ((i1 <= i2) && (!get_item_okay(i2))) i2--; |
|---|
| 1494 | | |
|---|
| 1495 | | /* Accept inventory */ |
|---|
| 1496 | | if (i1 <= i2) allow_inven = TRUE; |
|---|
| 1497 | | |
|---|
| 1498 | | |
|---|
| 1499 | | /* Full equipment */ |
|---|
| 1500 | | e1 = INVEN_WIELD; |
|---|
| 1501 | | e2 = INVEN_TOTAL - 1; |
|---|
| 1502 | | |
|---|
| 1503 | | /* Forbid equipment */ |
|---|
| 1504 | | if (!use_equip) e2 = -1; |
|---|
| 1505 | | |
|---|
| 1506 | | /* Restrict equipment indexes */ |
|---|
| 1507 | | while ((e1 <= e2) && (!get_item_okay(e1))) e1++; |
|---|
| 1508 | | while ((e1 <= e2) && (!get_item_okay(e2))) e2--; |
|---|
| 1509 | | |
|---|
| 1510 | | /* Accept equipment */ |
|---|
| 1511 | | if (e1 <= e2) allow_equip = TRUE; |
|---|
| 1512 | | |
|---|
| 1513 | | |
|---|
| 1514 | | /* Scan all non-gold objects in the grid */ |
|---|
| 1515 | | floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), py, px, 0x03); |
|---|
| 1516 | | |
|---|
| 1517 | | /* Full floor */ |
|---|
| 1518 | | f1 = 0; |
|---|
| 1519 | | f2 = floor_num - 1; |
|---|
| 1520 | | |
|---|
| 1521 | | /* Forbid floor */ |
|---|
| 1522 | | if (!use_floor) f2 = -1; |
|---|
| 1523 | | |
|---|
| 1524 | | /* Restrict floor indexes */ |
|---|
| 1525 | | while ((f1 <= f2) && (!get_item_okay(0 - floor_list[f1]))) f1++; |
|---|
| 1526 | | while ((f1 <= f2) && (!get_item_okay(0 - floor_list[f2]))) f2--; |
|---|
| 1527 | | |
|---|
| 1528 | | /* Accept floor */ |
|---|
| 1529 | | if (f1 <= f2) allow_floor = TRUE; |
|---|
| 1530 | | |
|---|
| 1531 | | |
|---|
| 1532 | | /* Require at least one legal choice */ |
|---|
| 1533 | | if (!allow_inven && !allow_equip && !allow_floor) |
|---|
| 1534 | | { |
|---|
| 1535 | | /* Cancel p_ptr->command_see */ |
|---|
| 1536 | | if (!OPT(show_lists)) p_ptr->command_see = FALSE; |
|---|
| 1537 | | |
|---|
| 1538 | | /* Oops */ |
|---|
| 1539 | | oops = TRUE; |
|---|
| 1540 | | |
|---|
| 1541 | | /* Done */ |
|---|
| 1542 | | done = TRUE; |
|---|
| 1543 | | } |
|---|
| 1544 | | |
|---|
| 1545 | | /* Analyze choices */ |
|---|
| 1546 | | else |
|---|
| 1547 | | { |
|---|
| 1548 | | /* Hack -- Start on equipment if requested */ |
|---|
| 1549 | | if (p_ptr->command_see && |
|---|
| 1550 | | (p_ptr->command_wrk == (USE_EQUIP)) && |
|---|
| 1551 | | use_equip) |
|---|
| 1552 | | { |
|---|
| 1553 | | p_ptr->command_wrk = (USE_EQUIP); |
|---|
| 1554 | | } |
|---|
| 1555 | | |
|---|
| 1556 | | /* Use inventory if allowed */ |
|---|
| 1557 | | else if (use_inven) |
|---|
| 1558 | | { |
|---|
| 1559 | | p_ptr->command_wrk = (USE_INVEN); |
|---|
| 1560 | | } |
|---|
| 1561 | | |
|---|
| 1562 | | /* Use equipment if allowed */ |
|---|
| 1563 | | else if (use_equip) |
|---|
| 1564 | | { |
|---|
| 1565 | | p_ptr->command_wrk = (USE_EQUIP); |
|---|
| 1566 | | } |
|---|
| 1567 | | |
|---|
| 1568 | | /* Use floor if allowed */ |
|---|
| 1569 | | else if (use_floor) |
|---|
| 1570 | | { |
|---|
| 1571 | | p_ptr->command_wrk = (USE_FLOOR); |
|---|
| 1572 | | } |
|---|
| 1573 | | |
|---|
| 1574 | | /* Hack -- Use (empty) inventory */ |
|---|
| 1575 | | else |
|---|
| 1576 | | { |
|---|
| 1577 | | p_ptr->command_wrk = (USE_INVEN); |
|---|
| 1578 | | } |
|---|
| 1579 | | } |
|---|
| 1580 | | |
|---|
| 1581 | | |
|---|
| 1582 | | /* Start out in "display" mode */ |
|---|
| 1583 | | if (p_ptr->command_see) |
|---|
| 1584 | | { |
|---|
| 1585 | | /* Save screen */ |
|---|
| 1586 | | screen_save(); |
|---|
| 1587 | | } |
|---|
| 1588 | | |
|---|
| 1589 | | |
|---|
| 1590 | | /* Repeat until done */ |
|---|
| 1591 | | while (!done) |
|---|
| 1592 | | { |
|---|
| 1593 | | int ni = 0; |
|---|
| 1594 | | int ne = 0; |
|---|
| 1595 | | |
|---|
| 1596 | | /* Scan windows */ |
|---|
| 1597 | | for (j = 0; j < ANGBAND_TERM_MAX; j++) |
|---|
| 1598 | | { |
|---|
| 1599 | | /* Unused */ |
|---|
| 1600 | | if (!angband_term[j]) continue; |
|---|
| 1601 | | |
|---|
| 1602 | | /* Count windows displaying inven */ |
|---|
| 1603 | | if (op_ptr->window_flag[j] & (PW_INVEN)) ni++; |
|---|
| 1604 | | |
|---|
| 1605 | | /* Count windows displaying equip */ |
|---|
| 1606 | | if (op_ptr->window_flag[j] & (PW_EQUIP)) ne++; |
|---|
| 1607 | | } |
|---|
| 1608 | | |
|---|
| 1609 | | /* Toggle if needed */ |
|---|
| 1610 | | if (((p_ptr->command_wrk == (USE_EQUIP)) && ni && !ne) || |
|---|
| 1611 | | ((p_ptr->command_wrk == (USE_INVEN)) && !ni && ne)) |
|---|
| 1612 | | { |
|---|
| 1613 | | /* Toggle */ |
|---|
| 1614 | | toggle_inven_equip(); |
|---|
| 1615 | | |
|---|
| 1616 | | /* Track toggles */ |
|---|
| 1617 | | toggle = !toggle; |
|---|
| 1618 | | } |
|---|
| 1619 | | |
|---|
| 1620 | | /* Redraw */ |
|---|
| 1621 | | p_ptr->redraw |= (PR_INVEN | PR_EQUIP); |
|---|
| 1622 | | |
|---|
| 1623 | | /* Redraw windows */ |
|---|
| 1624 | | redraw_stuff(); |
|---|
| 1625 | | |
|---|
| 1626 | | /* Viewing inventory */ |
|---|
| 1627 | | if (p_ptr->command_wrk == (USE_INVEN)) |
|---|
| 1628 | | { |
|---|
| 1629 | | /* Redraw if needed */ |
|---|
| 1630 | | if (p_ptr->command_see) show_inven(); |
|---|
| 1631 | | |
|---|
| 1632 | | /* Begin the prompt */ |
|---|
| 1633 | | strnfmt(out_val, sizeof(out_val), "Inven:"); |
|---|
| 1634 | | |
|---|
| 1635 | | /* List choices */ |
|---|
| 1636 | | if (i1 <= i2) |
|---|
| 1637 | | { |
|---|
| 1638 | | /* Build the prompt */ |
|---|
| 1639 | | strnfmt(tmp_val, sizeof(tmp_val), " %c-%c,", |
|---|
| 1640 | | index_to_label(i1), index_to_label(i2)); |
|---|
| 1641 | | |
|---|
| 1642 | | /* Append */ |
|---|
| 1643 | | my_strcat(out_val, tmp_val, sizeof(out_val)); |
|---|
| 1644 | | } |
|---|
| 1645 | | |
|---|
| 1646 | | /* Indicate ability to "view" */ |
|---|
| 1647 | | if (!p_ptr->command_see) my_strcat(out_val, " * to see,", sizeof(out_val)); |
|---|
| 1648 | | |
|---|
| 1649 | | /* Indicate legality of "toggle" */ |
|---|
| 1650 | | if (use_equip) my_strcat(out_val, " / for Equip,", sizeof(out_val)); |
|---|
| 1651 | | |
|---|
| 1652 | | /* Indicate legality of the "floor" */ |
|---|
| 1653 | | if (allow_floor) my_strcat(out_val, " - for floor,", sizeof(out_val)); |
|---|
| 1654 | | |
|---|
| 1655 | | /* Indicate that squelched items can be selected */ |
|---|
| 1656 | | if (can_squelch) my_strcat(out_val, " ! for squelched,", sizeof(out_val)); |
|---|
| 1657 | | } |
|---|
| 1658 | | |
|---|
| 1659 | | /* Viewing equipment */ |
|---|
| 1660 | | else if (p_ptr->command_wrk == (USE_EQUIP)) |
|---|
| 1661 | | { |
|---|
| 1662 | | &nb |
|---|