OSDN Git Service

[Refactor] format 関数の戻り値を std::string にする
[hengbandforosx/hengbandosx.git] / src / cmd-io / cmd-autopick.cpp
index 723469f..8e67d01 100644 (file)
@@ -101,7 +101,6 @@ void do_cmd_edit_autopick(PlayerType *player_ptr)
     static int cx_save = 0;
     static int cy_save = 0;
     autopick_type an_entry, *entry = &an_entry;
-    char buf[MAX_LINELEN];
     int i;
     int key = -1;
     static int32_t old_autosave_turn = 0L;
@@ -200,10 +199,10 @@ void do_cmd_edit_autopick(PlayerType *player_ptr)
     }
 
     screen_load();
-    strcpy(buf, pickpref_filename(player_ptr, tb->filename_mode));
+    const auto filename = pickpref_filename(player_ptr, tb->filename_mode);
 
     if (quit == APE_QUIT_AND_SAVE) {
-        write_text_lines(buf, tb->lines_list.data());
+        write_text_lines(filename.data(), tb->lines_list.data());
     }
 
     free_text_lines(tb->lines_list);
@@ -211,7 +210,7 @@ void do_cmd_edit_autopick(PlayerType *player_ptr)
     string_free(tb->last_destroyed);
     kill_yank_chain(tb);
 
-    process_autopick_file(player_ptr, buf);
+    process_autopick_file(player_ptr, filename.data());
     w_ptr->start_time = (uint32_t)time(nullptr);
     cx_save = tb->cx;
     cy_save = tb->cy;