OSDN Git Service

[Refactor] #3635 定数変数をmoveしないようにコンパイル警告を解消した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sun, 1 Oct 2023 04:15:29 +0000 (13:15 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 1 Oct 2023 04:37:46 +0000 (13:37 +0900)
28 files changed:
src/cmd-io/cmd-process-screen.cpp
src/cmd-item/cmd-equipment.cpp
src/cmd-item/cmd-item.cpp
src/cmd-visual/cmd-draw.cpp
src/cmd-visual/cmd-map.cpp
src/core/show-file.cpp
src/core/window-redrawer.cpp
src/floor/object-scanner.cpp
src/io-dump/dump-util.cpp
src/io/record-play-movie.cpp
src/io/report.cpp
src/io/signal-handlers.cpp
src/io/write-diary.cpp
src/knowledge/knowledge-features.cpp
src/knowledge/knowledge-items.cpp
src/knowledge/knowledge-monsters.cpp
src/perception/identification.cpp
src/store/cmd-store.cpp
src/term/screen-processor.cpp
src/util/candidate-selector.cpp
src/view/display-inventory.cpp
src/view/display-player-misc-info.cpp
src/window/display-sub-windows.cpp
src/window/main-window-equipments.cpp
src/window/main-window-left-frame.cpp
src/window/main-window-stat-poster.cpp
src/wizard/cmd-wizard.cpp
src/world/world-turn-processor.cpp

index 60e7ec0..ddc8cd4 100644 (file)
@@ -203,7 +203,7 @@ static void write_html_footer(FILE *tmpfff, FILE *fff)
 
 void exe_cmd_save_screen_html(const std::filesystem::path &path, bool need_message)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto *fff = angband_fopen(path, FileOpenMode::WRITE);
     if (!check_screen_html_can_open(fff, path, need_message)) {
         return;
@@ -375,7 +375,7 @@ void do_cmd_save_screen(PlayerType *player_ptr)
         return;
     }
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto old_use_graphics = update_use_graphics(player_ptr);
 
     if (html_dump) {
@@ -487,7 +487,7 @@ static void draw_colored_characters(FILE *fff, int wid, int hgt, bool okay)
  */
 void do_cmd_load_screen(void)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto path = path_build(ANGBAND_DIR_USER, "dump.txt");
     auto *fff = angband_fopen(path, FileOpenMode::READ);
     if (!fff) {
index e7e0945..544bbdf 100644 (file)
@@ -119,7 +119,7 @@ void do_cmd_equip(PlayerType *player_ptr)
         return;
     }
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     command_new = 0;
     command_gap = wid - 30;
 }
index 0dd8f8f..4db1a82 100644 (file)
@@ -99,7 +99,7 @@ void do_cmd_inven(PlayerType *player_ptr)
         return;
     }
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     command_new = 0;
     command_gap = wid - 30;
 }
index eaec812..0eb2ebe 100644 (file)
@@ -205,7 +205,7 @@ void do_cmd_messages(int num_now)
     std::string shower_str("");
     std::string finder_str("");
     std::string shower("");
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto num_lines = hgt - 4;
     auto n = message_num();
     auto i = 0;
index d0ab409..ce15e34 100644 (file)
@@ -24,7 +24,7 @@ void do_cmd_view_map(PlayerType *player_ptr)
     int cy, cx;
     display_map(player_ptr, &cy, &cx);
     if (autopick_list.empty() || player_ptr->wild_mode) {
-        const auto [wid, hgt] = term_get_size();
+        const auto &[wid, hgt] = term_get_size();
         constexpr auto msg = _("何かキーを押すとゲームに戻ります", "Hit any key to continue");
         const auto center_x = (wid - std::string_view(msg).length()) / 2;
         put_str(msg, hgt - 1, center_x);
@@ -36,7 +36,7 @@ void do_cmd_view_map(PlayerType *player_ptr)
 
     display_autopick = ITEM_DISPLAY;
     while (true) {
-        const auto [wid, hgt] = term_get_size();
+        const auto &[wid, hgt] = term_get_size();
         int row_message = hgt - 1;
         put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
                     " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."),
index 79b6cde..12fdafa 100644 (file)
@@ -139,7 +139,7 @@ bool show_file(PlayerType *player_ptr, bool show_version, std::string_view name_
 {
     TermCenteredOffsetSetter tcos(MAIN_TERM_MIN_COLS, std::nullopt);
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
 
     char hook[68][32]{};
     auto stripped_names = str_split(name_with_tag, '#');
index 0ec4363..6326479 100644 (file)
@@ -48,7 +48,7 @@ void redraw_window()
  */
 static void print_dungeon(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
 
     c_put_str(TERM_WHITE, "             ", hgt + ROW_DUNGEON, COL_DUNGEON);
     const auto dungeon_name = map_name(player_ptr);
index aa2c5ea..31dbc7c 100644 (file)
@@ -115,7 +115,7 @@ COMMAND_CODE show_floor_items(PlayerType *player_ptr, int target_item, POSITION
     ITEM_NUMBER floor_num;
     char floor_label[52 + 1]{};
     auto dont_need_to_show_weights = true;
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto len = std::max((*min_width), 20);
     floor_num = scan_floor_items(player_ptr, floor_list, y, x, SCAN_FLOOR_ITEM_TESTER | SCAN_FLOOR_ONLY_MARKED, item_tester);
     auto *floor_ptr = player_ptr->current_floor_ptr;
index e9eb7c9..6c0f7f1 100644 (file)
@@ -277,7 +277,7 @@ void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt, IDX *list_c
 
     if ((ddx[d] > 0) && ddy[d]) {
         int browser_rows;
-        const auto [wid, hgt] = term_get_size();
+        const auto &[wid, hgt] = term_get_size();
         browser_rows = hgt - 8;
         if (!col) {
             int old_grp = grp;
index b20cce1..a8d199c 100644 (file)
@@ -499,10 +499,9 @@ static bool get_nextbuf(char *buf)
 /* プレイホストのマップが大きいときクライアントのマップもリサイズする */
 static void update_term_size(int x, int y, int len)
 {
-    int nx, ny;
-    const auto [ox, oy] = term_get_size();
-    nx = ox;
-    ny = oy;
+    const auto &[ox, oy] = term_get_size();
+    auto nx = ox;
+    auto ny = oy;
 
     /* 横方向のチェック */
     if (x + len > ox) {
index 44a6945..5de20c0 100644 (file)
@@ -145,7 +145,7 @@ concptr make_screen_dump(PlayerType *player_ptr)
         "</pre>\n"
         "</body>\n</html>\n";
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     std::stringstream screen_ss;
 
     auto &rfu = RedrawingFlagsUpdater::get_instance();
index 2c671b2..fb659a9 100644 (file)
@@ -118,7 +118,7 @@ static void handle_signal_simple(int sig)
  */
 static void handle_signal_abort(int sig)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     (void)signal(sig, SIG_IGN);
     if (!w_ptr->character_generated || w_ptr->character_saved) {
         quit(nullptr);
index d770506..485a821 100644 (file)
@@ -188,7 +188,7 @@ int exe_write_diary_quest(PlayerType *player_ptr, DiaryKind dk, QuestId num)
     parse_fixed_map(player_ptr, QUEST_DEFINITION_LIST, 0, 0, 0, 0);
     floor.quest_number = old_quest;
 
-    const auto [q_idx, note_level] = write_floor(floor);
+    const auto &[q_idx, note_level] = write_floor(floor);
 
     FILE *fff = nullptr;
     if (!open_diary_file(&fff, &disable_diary)) {
@@ -270,7 +270,7 @@ void exe_write_diary(PlayerType *player_ptr, DiaryKind dk, int num, std::string_
     }
 
     const auto &floor = *player_ptr->current_floor_ptr;
-    const auto [q_idx, note_level] = write_floor(floor);
+    const auto &[q_idx, note_level] = write_floor(floor);
     auto do_level = true;
     switch (dk) {
     case DiaryKind::DIALY:
index ad79efd..eaecf71 100644 (file)
@@ -106,7 +106,7 @@ void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f
     TERM_COLOR attr_old[F_LIT_MAX] = {};
     char char_old[F_LIT_MAX] = {};
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     std::vector<FEAT_IDX> feat_idx(terrains_info.size());
 
     concptr feature_group_text[] = { "terrains", nullptr };
index ad29257..65185c6 100644 (file)
@@ -253,7 +253,7 @@ void do_cmd_knowledge_objects(PlayerType *player_ptr, bool *need_redraw, bool vi
     byte char_left = 0;
     byte mode;
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto browser_rows = hgt - 8;
     std::vector<short> object_idx(baseitems_info.size());
 
index dd4b588..9ef647c 100644 (file)
@@ -294,7 +294,7 @@ void do_cmd_knowledge_monsters(PlayerType *player_ptr, bool *need_redraw, bool v
 {
     TermCenteredOffsetSetter tcos(MAIN_TERM_MIN_COLS, std::nullopt);
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     std::vector<MonsterRaceId> r_idx_list;
     std::vector<IDX> grp_idx;
 
index 5744e1f..5f40f9a 100644 (file)
@@ -790,7 +790,7 @@ bool screen_object(PlayerType *player_ptr, ItemEntity *o_ptr, BIT_FLAGS mode)
     }
 
     screen_save();
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     std::string item_name;
     if (!(mode & SCROBJ_FAKE_OBJECT)) {
         item_name = describe_flavor(player_ptr, o_ptr, 0);
index a20114c..2cc531e 100644 (file)
@@ -56,7 +56,7 @@ void do_cmd_store(PlayerType *player_ptr)
         return;
     }
     TermCenteredOffsetSetter tcos(MAIN_TERM_MIN_COLS, std::nullopt);
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     xtra_stock = std::min(14 + 26, ((hgt > MAIN_TERM_MIN_ROWS) ? (hgt - MAIN_TERM_MIN_ROWS) : 0));
     store_bottom = MIN_STOCK + xtra_stock;
 
index 4332f05..2faa4c8 100644 (file)
@@ -171,7 +171,7 @@ static std::vector<std::pair<TERM_COLOR, char>> c_roff_wrap(int x, int y, int w,
  */
 void c_roff(TERM_COLOR a, std::string_view str)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     int x, y;
     (void)term_locate(&x, &y);
 
index e4b6ff8..087f0f5 100644 (file)
@@ -60,6 +60,6 @@ std::pair<size_t, std::optional<size_t>> CandidateSelector::process_input(char c
  */
 void CandidateSelector::set_max_per_page(size_t max)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     this->max_per_page = std::min<size_t>(max, hgt - 2);
 }
index 9ecdbd5..ed89328 100644 (file)
@@ -39,7 +39,7 @@ COMMAND_CODE show_inventory(PlayerType *player_ptr, int target_item, BIT_FLAGS m
     char inven_label[52 + 1];
 
     auto col = command_gap;
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto len = wid - col - 1;
     for (i = 0; i < INVEN_PACK; i++) {
         o_ptr = &player_ptr->inventory_list[i];
@@ -145,7 +145,7 @@ void display_inventory(PlayerType *player_ptr, const ItemTester &item_tester)
         return;
     }
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     for (i = 0; i < INVEN_PACK; i++) {
         auto o_ptr = &player_ptr->inventory_list[i];
         if (!o_ptr->is_valid()) {
index f9bd017..40dba8b 100644 (file)
@@ -27,7 +27,7 @@ void display_player_name(PlayerType *player_ptr, bool name_only)
     constexpr std::string_view header = _("名前  : ", "Name  : ");
     const auto length = header.length() + display_name.length();
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto center_col = (wid - length) / 2 - 4; // ヘッダがあるぶん少し左に寄せたほうが見やすい
     constexpr auto row = 1;
 
index 6beaa07..55e48ea 100644 (file)
@@ -272,7 +272,7 @@ void fix_monster_list(PlayerType *player_ptr)
 
     display_sub_windows(SubWindowRedrawingFlag::SIGHT_MONSTERS,
         [player_ptr, &once] {
-            const auto [wid, hgt] = term_get_size();
+            const auto &[wid, hgt] = term_get_size();
             std::call_once(once, target_sensing_monsters_prepare, player_ptr, monster_list);
             print_monster_list(player_ptr->current_floor_ptr, monster_list, 0, 0, hgt);
         });
@@ -290,7 +290,7 @@ void fix_pet_list(PlayerType *player_ptr)
 {
     display_sub_windows(SubWindowRedrawingFlag::PETS,
         [player_ptr] {
-            const auto [wid, hgt] = term_get_size();
+            const auto &[wid, hgt] = term_get_size();
             const auto pets = target_pets_prepare(player_ptr);
             print_pet_list(player_ptr, pets, 0, 0, wid, hgt);
         });
@@ -306,7 +306,7 @@ static void display_equipment(PlayerType *player_ptr, const ItemTester &item_tes
         return;
     }
 
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     byte attr = TERM_WHITE;
     for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
         int cur_row = i - INVEN_MAIN_HAND;
@@ -408,7 +408,7 @@ void fix_message(void)
 {
     display_sub_windows(SubWindowRedrawingFlag::MESSAGE,
         [] {
-            const auto [wid, hgt] = term_get_size();
+            const auto &[wid, hgt] = term_get_size();
             for (short i = 0; i < hgt; i++) {
                 term_putstr(0, (hgt - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), *message_str(i));
                 TERM_LEN x, y;
@@ -430,7 +430,7 @@ void fix_overhead(PlayerType *player_ptr)
 {
     display_sub_windows(SubWindowRedrawingFlag::OVERHEAD,
         [player_ptr] {
-            const auto [wid, hgt] = term_get_size();
+            const auto &[wid, hgt] = term_get_size();
             if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2) {
                 int cy, cx;
                 display_map(player_ptr, &cy, &cx);
@@ -547,7 +547,7 @@ static const MonsterEntity *monster_on_floor_items(FloorType *floor_ptr, const g
  */
 static void display_floor_item_list(PlayerType *player_ptr, const int y, const int x)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     if (hgt <= 0) {
         return;
     }
@@ -632,7 +632,7 @@ void fix_floor_item_list(PlayerType *player_ptr, const int y, const int x)
  */
 static void display_found_item_list(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     if (hgt <= 0) {
         return;
     }
index c1f1413..224cdc0 100644 (file)
@@ -41,7 +41,7 @@ COMMAND_CODE show_equipment(PlayerType *player_ptr, int target_item, BIT_FLAGS m
     COMMAND_CODE target_item_label = 0;
     char equip_label[52 + 1];
     auto col = command_gap;
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto len = wid - col - 1;
     for (k = 0, i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
         o_ptr = &player_ptr->inventory_list[i];
index 80cdf4f..ffd208b 100644 (file)
@@ -174,7 +174,7 @@ void print_gold(PlayerType *player_ptr)
 void print_depth(PlayerType *player_ptr)
 {
     TERM_COLOR attr = TERM_WHITE;
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     TERM_LEN col_depth = wid + COL_DEPTH;
     TERM_LEN row_depth = hgt + ROW_DEPTH;
 
@@ -370,7 +370,7 @@ void print_health(PlayerType *player_ptr, bool riding)
     }
 
     const auto max_width = 12; // 表示幅
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto extra_line_count = riding ? 0 : hgt - MAIN_TERM_MIN_ROWS;
     for (auto y = row; y < row + extra_line_count + 1; ++y) {
         term_erase(col, y, max_width);
@@ -387,8 +387,7 @@ void print_health(PlayerType *player_ptr, bool riding)
         return;
     }
 
-    const auto [hit_point_bar_color, len] = monster.get_hp_bar_data();
-
+    const auto &[hit_point_bar_color, len] = monster.get_hp_bar_data();
     term_putstr(col, row, max_width, TERM_WHITE, "[----------]");
     term_putstr(col + 1, row, len, hit_point_bar_color, "**********");
 
index f684b05..06b36d1 100644 (file)
@@ -255,7 +255,7 @@ void print_state(PlayerType *player_ptr)
  */
 void print_speed(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     auto col_speed = wid + COL_SPEED;
     auto row_speed = hgt + ROW_SPEED;
 
@@ -316,7 +316,7 @@ void print_speed(PlayerType *player_ptr)
  */
 void print_study(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto col_study = wid + COL_STUDY;
     const auto row_study = hgt + ROW_STUDY;
     if (player_ptr->new_spells) {
@@ -332,7 +332,7 @@ void print_study(PlayerType *player_ptr)
  */
 void print_imitation(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto col_study = wid + COL_STUDY;
     const auto row_study = hgt + ROW_STUDY;
     PlayerClass pc(player_ptr);
@@ -445,7 +445,7 @@ static void add_hex_status_flags(PlayerType *player_ptr, BIT_FLAGS *bar_flags)
  */
 void print_status(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto row_statbar = hgt + ROW_STATBAR;
     const auto max_col_statbar = wid + MAX_COL_STATBAR;
     term_erase(0, row_statbar, max_col_statbar);
index c8f2227..fe01715 100644 (file)
@@ -293,7 +293,7 @@ bool exe_cmd_debug(PlayerType *player_ptr, char cmd)
  */
 void do_cmd_debug(PlayerType *player_ptr)
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto max_line = debug_menu_table.size();
     const auto page_size = hgt - 5;
     const auto max_page = max_line / page_size + 1;
index e983e8e..ec18fb9 100644 (file)
@@ -103,7 +103,7 @@ void WorldTurnProcessor::process_world()
  */
 void WorldTurnProcessor::print_time()
 {
-    const auto [wid, hgt] = term_get_size();
+    const auto &[wid, hgt] = term_get_size();
     const auto row = hgt + ROW_DAY;
 
     int day;