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 "system/item-entity.h"
10 #include "system/player-type-definition.h"
11 #include "system/redrawing-flags-updater.h"
12 #include "util/bit-flags-calculator.h"
13 #include "util/quarks.h"
16 * @brief 自動拾い/破壊設定のリストに関する変数 / List for auto-picker/destroyer entries
18 std::vector<autopick_type> autopick_list; /*!< 自動拾い/破壊設定構造体の配列 */
21 * @brief Automatically destroy an item if it is to be destroyed
23 * When always_pickup is 'yes', we disable auto-destroyer function of
24 * auto-picker/destroyer, and do only easy-auto-destroyer.
26 ItemEntity autopick_last_destroyed_object;
28 bool autopick_type::has(int flag) const
30 return this->flags[flag / 32] & (1UL << (flag % 32));
33 void autopick_type::add(int flag)
35 set_bits(this->flags[flag / 32], 1UL << (flag % 32));
38 void autopick_type::remove(int flag)
40 reset_bits(this->flags[flag / 32], 1UL << (flag % 32));
44 * @brief Free memory of lines_list.
46 void free_text_lines(std::vector<concptr> &lines_list)
48 for (int lines = 0; lines_list[lines]; lines++) {
49 string_free(lines_list[lines]);
56 * @brief Find a command by 'key'.
58 int get_com_id(char key)
60 for (int i = 0; menu_data[i].name; i++) {
61 if (menu_data[i].key == key) {
62 return menu_data[i].com_id;
70 * @brief Auto inscription
72 void auto_inscribe_item(PlayerType *player_ptr, ItemEntity *o_ptr, int idx)
74 if (idx < 0 || autopick_list[idx].insc.empty()) {
78 if (!o_ptr->is_inscribed()) {
79 o_ptr->inscription = autopick_list[idx].insc;
82 auto &rfu = RedrawingFlagsUpdater::get_instance();
83 player_ptr->window_flags |= (PW_EQUIPMENT | PW_INVENTORY);
85 StatusRedrawingFlag::BONUS,
86 StatusRedrawingFlag::COMBINATION,
93 * @param tb text_body_type
96 int count_line(text_body_type *tb)
99 for (num_lines = 0; tb->lines_list[num_lines]; num_lines++) {