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