1 #include "autopick/autopick-util.h"
2 #include "autopick/autopick-menu-data-table.h"
3 #include "game-option/input-options.h"
4 #include "main/sound-of-music.h"
5 #include "monster-race/race-indice-types.h"
6 #include "object-enchant/item-feeling.h"
7 #include "util/quarks.h"
10 * 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
12 int max_autopick = 0; /*!< 現在登録している自動拾い/破壊設定の数 */
13 int max_max_autopick = 0; /*!< 自動拾い/破壊設定の限界数 */
14 autopick_type *autopick_list = NULL; /*!< 自動拾い/破壊設定構造体のポインタ配列 */
17 * Automatically destroy an item if it is to be destroyed
19 * When always_pickup is 'yes', we disable auto-destroyer function of
20 * auto-picker/destroyer, and do only easy-auto-destroyer.
22 object_type autopick_last_destroyed_object;
25 * A function to delete entry
27 void autopick_free_entry(autopick_type *entry)
29 string_free(entry->name);
30 string_free(entry->insc);
37 * Free memory of lines_list.
39 void free_text_lines(concptr *lines_list)
41 for (int lines = 0; lines_list[lines]; lines++)
43 string_free(lines_list[lines]);
46 /* free list of pointers */
47 C_KILL(lines_list, MAX_LINES, concptr);
52 * Find a command by 'key'.
54 int get_com_id(char key)
56 for (int i = 0; menu_data[i].name; i++)
58 if (menu_data[i].key == key)
60 return menu_data[i].com_id;
71 void auto_inscribe_item(player_type *player_ptr, object_type *o_ptr, int idx)
73 if (idx < 0 || !autopick_list[idx].insc) return;
75 if (!o_ptr->inscription)
76 o_ptr->inscription = quark_add(autopick_list[idx].insc);
78 player_ptr->window |= (PW_EQUIP | PW_INVEN);
79 player_ptr->update |= (PU_BONUS);
84 * Add one line to autopick_list[]
86 void add_autopick_list(autopick_type *entry)
88 if (max_autopick >= max_max_autopick)
90 int old_max_max_autopick = max_max_autopick;
91 autopick_type *old_autopick_list = autopick_list;
92 max_max_autopick += MAX_AUTOPICK_DEFAULT;
93 C_MAKE(autopick_list, max_max_autopick, autopick_type);
94 (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
95 C_KILL(old_autopick_list, old_max_max_autopick, autopick_type);
98 autopick_list[max_autopick] = *entry;