From caafd849860b282746496542e76e05eb68a13f19 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 26 Apr 2020 15:27:19 +0900 Subject: [PATCH] [Refactor] #39964 Removed the dependency from read-pref-file to autopick-pref-processor --- src/autopick/autopick-reader-writer.c | 5 +++-- src/birth.c | 18 +++++++++--------- src/birth.h | 2 +- src/cmd/cmd-autopick.c | 3 ++- src/cmd/cmd-dump.c | 4 ++-- src/cmd/cmd-dump.h | 2 +- src/cmd/cmd-macro.c | 4 ++-- src/cmd/cmd-macro.h | 2 +- src/cmd/cmd-process-screen.c | 10 +++++----- src/cmd/cmd-process-screen.h | 2 +- src/cmd/cmd-visuals.c | 6 +++--- src/cmd/cmd-visuals.h | 2 +- src/core.c | 31 ++++++++++++++++--------------- src/init.c | 6 +++--- src/init.h | 2 +- src/io/read-pref-file.c | 24 ++++++++++++------------ src/io/read-pref-file.h | 6 +++--- src/main-win.c | 5 +++-- src/market/store.c | 9 +++++---- src/monster-status.c | 3 ++- src/object.h | 2 +- src/object1.c | 6 +++--- src/player-damage.c | 7 ++++--- src/report.c | 6 +++--- src/report.h | 2 +- 25 files changed, 88 insertions(+), 81 deletions(-) diff --git a/src/autopick/autopick-reader-writer.c b/src/autopick/autopick-reader-writer.c index c18102dac..79875a37b 100644 --- a/src/autopick/autopick-reader-writer.c +++ b/src/autopick/autopick-reader-writer.c @@ -1,6 +1,7 @@ #include "angband.h" #include "autopick/autopick-reader-writer.h" #include "autopick/autopick-initializer.h" +#include "autopick/autopick-pref-processor.h" #include "files.h" #include "io/read-pref-file.h" @@ -12,7 +13,7 @@ void autopick_load_pref(player_type *player_ptr, bool disp_mes) GAME_TEXT buf[80]; init_autopick(); my_strcpy(buf, pickpref_filename(player_ptr, PT_WITH_PNAME), sizeof(buf)); - errr err = process_autopick_file(player_ptr, buf); + errr err = process_autopick_file(player_ptr, buf, process_autopick_file_command); if (err == 0 && disp_mes) { msg_format(_("%s‚ð“ǂݍž‚Ý‚Ü‚µ‚½B", "Loaded '%s'."), buf); @@ -21,7 +22,7 @@ void autopick_load_pref(player_type *player_ptr, bool disp_mes) if (err < 0) { my_strcpy(buf, pickpref_filename(player_ptr, PT_DEFAULT), sizeof(buf)); - err = process_autopick_file(player_ptr, buf); + err = process_autopick_file(player_ptr, buf, process_autopick_file_command); if (err == 0 && disp_mes) { msg_format(_("%s‚ð“ǂݍž‚Ý‚Ü‚µ‚½B", "Loaded '%s'."), buf); diff --git a/src/birth.c b/src/birth.c index f7e6bc3e6..95f47fc99 100644 --- a/src/birth.c +++ b/src/birth.c @@ -3554,7 +3554,7 @@ void add_history_from_pref_line(concptr t) * @brief 生い立ちメッセージをファイルからロードする。 * @return なし */ -static bool do_cmd_histpref(player_type *creature_ptr) +static bool do_cmd_histpref(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { char buf[80]; errr err; @@ -3574,7 +3574,7 @@ static bool do_cmd_histpref(player_type *creature_ptr) #else sprintf(buf, "histpref-%s.prf", creature_ptr->base_name); #endif - err = process_histpref_file(creature_ptr, buf); + err = process_histpref_file(creature_ptr, buf, process_autopick_file_command); /* Process 'hist????.prf' if 'hist????-.prf' doesn't exist */ if (0 > err) @@ -3584,7 +3584,7 @@ static bool do_cmd_histpref(player_type *creature_ptr) #else strcpy(buf, "histpref.prf"); #endif - err = process_histpref_file(creature_ptr, buf); + err = process_histpref_file(creature_ptr, buf, process_autopick_file_command); } if (err) @@ -3651,7 +3651,7 @@ static bool do_cmd_histpref(player_type *creature_ptr) * @brief 生い立ちメッセージを編集する。/Character background edit-mode * @return なし */ -static void edit_history(player_type *creature_ptr) +static void edit_history(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { char old_history[4][60]; TERM_LEN y = 0, x = 0; @@ -3780,7 +3780,7 @@ static void edit_history(player_type *creature_ptr) } else if (c == KTRL('A')) { - if (do_cmd_histpref(creature_ptr)) + if (do_cmd_histpref(creature_ptr, process_autopick_file_command)) { #ifdef JP if ((x > 0) && (iskanji2(creature_ptr->history[y], x - 1))) x--; @@ -3861,7 +3861,7 @@ static void edit_history(player_type *creature_ptr) * expensive CPU wise. And it cuts down on player stupidity. * @return なし */ -static bool player_birth_aux(player_type *creature_ptr) +static bool player_birth_aux(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { int i, k, n, cs, os; @@ -4439,7 +4439,7 @@ static bool player_birth_aux(player_type *creature_ptr) process_player_name(creature_ptr, current_world_ptr->creating_savefile); /*** Edit character background ***/ - edit_history(creature_ptr); + edit_history(creature_ptr, process_autopick_file_command); /*** Finish up ***/ @@ -4552,7 +4552,7 @@ static bool ask_quick_start(player_type *creature_ptr) * fields, so we must be sure to clear them first. * @return なし */ -void player_birth(player_type *creature_ptr) +void player_birth(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { int i, j; char buf[80]; @@ -4575,7 +4575,7 @@ void player_birth(player_type *creature_ptr) while (TRUE) { /* Roll up a new character */ - if (player_birth_aux(creature_ptr)) break; + if (player_birth_aux(creature_ptr, process_autopick_file_command)) break; /* Wipe the player */ player_wipe_without_name(creature_ptr); diff --git a/src/birth.h b/src/birth.h index a73fd8b11..a68c86223 100644 --- a/src/birth.h +++ b/src/birth.h @@ -38,7 +38,7 @@ extern birther previous_char; /* birth.c */ extern void add_history_from_pref_line(concptr t); -extern void player_birth(player_type *creature_ptr); +extern void player_birth(player_type *creature_ptr, void(*process_autopick_file_command)(char*)); extern void get_max_stats(player_type *creature_ptr); extern void get_height_weight(player_type *creature_ptr); extern void player_outfit(player_type *creature_ptr); diff --git a/src/cmd/cmd-autopick.c b/src/cmd/cmd-autopick.c index 0f8e214de..ffe17118e 100644 --- a/src/cmd/cmd-autopick.c +++ b/src/cmd/cmd-autopick.c @@ -12,6 +12,7 @@ #include "autopick/autopick-editor-command.h" #include "autopick/autopick-editor-util.h" #include "autopick/autopick-inserter-killer.h" +#include "autopick/autopick-pref-processor.h" #include "io/read-pref-file.h" #include "world.h" #include "view/display-main-window.h" // 暫定。後で消す. @@ -203,7 +204,7 @@ void do_cmd_edit_autopick(player_type *player_ptr) string_free(tb->last_destroyed); kill_yank_chain(tb); - process_autopick_file(player_ptr, buf); + process_autopick_file(player_ptr, buf, process_autopick_file_command); current_world_ptr->start_time = (u32b)time(NULL); cx_save = tb->cx; cy_save = tb->cy; diff --git a/src/cmd/cmd-dump.c b/src/cmd/cmd-dump.c index b11568f2c..c5fbe4251 100644 --- a/src/cmd/cmd-dump.c +++ b/src/cmd/cmd-dump.c @@ -71,7 +71,7 @@ void do_cmd_pref(player_type *creature_ptr) /* * Interact with "colors" */ -void do_cmd_colors(player_type *creature_ptr) +void do_cmd_colors(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { int i; char tmp[160]; @@ -97,7 +97,7 @@ void do_cmd_colors(player_type *creature_ptr) sprintf(tmp, "%s.prf", creature_ptr->base_name); if (!askfor(tmp, 70)) continue; - (void)process_pref_file(creature_ptr, tmp); + (void)process_pref_file(creature_ptr, tmp, process_autopick_file_command); Term_xtra(TERM_XTRA_REACT, 0); Term_redraw(); } diff --git a/src/cmd/cmd-dump.h b/src/cmd/cmd-dump.h index 17e2937aa..091158091 100644 --- a/src/cmd/cmd-dump.h +++ b/src/cmd/cmd-dump.h @@ -1,7 +1,7 @@ #pragma once extern void do_cmd_pref(player_type *creature_ptr); -extern void do_cmd_colors(player_type *creature_ptr); +extern void do_cmd_colors(player_type *creature_ptr, void(*process_autopick_file_command)(char*)); extern void do_cmd_note(void); extern void do_cmd_version(void); extern void do_cmd_feeling(player_type *creature_ptr); diff --git a/src/cmd/cmd-macro.c b/src/cmd/cmd-macro.c index fc5056b0e..78b72c295 100644 --- a/src/cmd/cmd-macro.c +++ b/src/cmd/cmd-macro.c @@ -148,7 +148,7 @@ static errr keymap_dump(concptr fname) * Could use some helpful instructions on this page. * */ -void do_cmd_macros(player_type *creature_ptr) +void do_cmd_macros(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { char tmp[1024]; char buf[1024]; @@ -186,7 +186,7 @@ void do_cmd_macros(player_type *creature_ptr) sprintf(tmp, "%s.prf", creature_ptr->base_name); if (!askfor(tmp, 80)) continue; - errr err = process_pref_file(creature_ptr, tmp); + errr err = process_pref_file(creature_ptr, tmp, process_autopick_file_command); if (-2 == err) msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp); else if (err) diff --git a/src/cmd/cmd-macro.h b/src/cmd/cmd-macro.h index 4c415c6be..4a0bfba34 100644 --- a/src/cmd/cmd-macro.h +++ b/src/cmd/cmd-macro.h @@ -1,3 +1,3 @@ #pragma once -void do_cmd_macros(player_type *creature_ptr); +void do_cmd_macros(player_type *creature_ptr, void(*process_autopick_file_command)(char*)); diff --git a/src/cmd/cmd-process-screen.c b/src/cmd/cmd-process-screen.c index 8818f02c1..6b1fd9883 100644 --- a/src/cmd/cmd-process-screen.c +++ b/src/cmd/cmd-process-screen.c @@ -333,12 +333,12 @@ static bool do_cmd_save_screen_text(int wid, int hgt) * @param handle_stuff 画面更新用の関数ポインタ * @return 記念撮影直前のグラフィックオプション */ -static bool update_use_graphics(player_type *creature_ptr, void(*handle_stuff)(player_type*)) +static bool update_use_graphics(player_type *creature_ptr, void(*handle_stuff)(player_type*), void(*process_autopick_file_command)(char*)) { if (!use_graphics) return TRUE; use_graphics = FALSE; - reset_visuals(creature_ptr); + reset_visuals(creature_ptr, process_autopick_file_command); creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); (*handle_stuff)(creature_ptr); return FALSE; @@ -351,7 +351,7 @@ static bool update_use_graphics(player_type *creature_ptr, void(*handle_stuff)(p * @param handle_stuff 画面更新用の関数ポインタ * @return なし */ -void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*)) +void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*), void(*process_autopick_file_command)(char*)) { prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0); bool html_dump; @@ -360,7 +360,7 @@ void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_ty int wid, hgt; Term_get_size(&wid, &hgt); - bool old_use_graphics = update_use_graphics(creature_ptr, handle_stuff); + bool old_use_graphics = update_use_graphics(creature_ptr, handle_stuff, process_autopick_file_command); if (html_dump) { @@ -375,7 +375,7 @@ void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_ty if (old_use_graphics) return; use_graphics = TRUE; - reset_visuals(creature_ptr); + reset_visuals(creature_ptr, process_autopick_file_command); creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); handle_stuff(creature_ptr); } diff --git a/src/cmd/cmd-process-screen.h b/src/cmd/cmd-process-screen.h index 0988ddffc..c801a3686 100644 --- a/src/cmd/cmd-process-screen.h +++ b/src/cmd/cmd-process-screen.h @@ -1,5 +1,5 @@ #pragma once void do_cmd_save_screen_html_aux(char *filename, int message); -void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*)); +void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*), void(*process_autopick_file_command)(char*)); void do_cmd_load_screen(void); diff --git a/src/cmd/cmd-visuals.c b/src/cmd/cmd-visuals.c index 34904fffe..9a2158adb 100644 --- a/src/cmd/cmd-visuals.c +++ b/src/cmd/cmd-visuals.c @@ -66,7 +66,7 @@ static void print_visuals_menu(concptr choice_msg) /* * Interact with "visuals" */ -void do_cmd_visuals(player_type *creature_ptr) +void do_cmd_visuals(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { FILE *auto_dump_stream; char tmp[160]; @@ -93,7 +93,7 @@ void do_cmd_visuals(player_type *creature_ptr) sprintf(tmp, "%s.prf", creature_ptr->base_name); if (!askfor(tmp, 70)) continue; - (void)process_pref_file(creature_ptr, tmp); + (void)process_pref_file(creature_ptr, tmp, process_autopick_file_command); need_redraw = TRUE; break; } @@ -436,7 +436,7 @@ void do_cmd_visuals(player_type *creature_ptr) } case 'R': case 'r': - reset_visuals(creature_ptr); + reset_visuals(creature_ptr, process_autopick_file_command); msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset.")); need_redraw = TRUE; break; diff --git a/src/cmd/cmd-visuals.h b/src/cmd/cmd-visuals.h index d95e43f26..2b6517445 100644 --- a/src/cmd/cmd-visuals.h +++ b/src/cmd/cmd-visuals.h @@ -1,3 +1,3 @@ #pragma once -void do_cmd_visuals(player_type *creature_ptr); +void do_cmd_visuals(player_type *creature_ptr, void(*process_autopick_file_command)(char*)); diff --git a/src/core.c b/src/core.c index f3ca01e18..aeff6148f 100644 --- a/src/core.c +++ b/src/core.c @@ -107,6 +107,7 @@ #include "files.h" #include "scores.h" #include "autopick/autopick.h" +#include "autopick/autopick-pref-processor.h" #include "autopick/autopick-reader-writer.h" #include "save.h" #include "realm.h" @@ -3425,18 +3426,18 @@ static void process_command(player_type *creature_ptr) } case '@': { - do_cmd_macros(creature_ptr); + do_cmd_macros(creature_ptr, process_autopick_file_command); break; } case '%': { - do_cmd_visuals(creature_ptr); + do_cmd_visuals(creature_ptr, process_autopick_file_command); do_cmd_redraw(creature_ptr); break; } case '&': { - do_cmd_colors(creature_ptr); + do_cmd_colors(creature_ptr, process_autopick_file_command); do_cmd_redraw(creature_ptr); break; } @@ -3521,7 +3522,7 @@ static void process_command(player_type *creature_ptr) } case ')': { - do_cmd_save_screen(creature_ptr, handle_stuff); + do_cmd_save_screen(creature_ptr, handle_stuff, process_autopick_file_command); break; } case ']': @@ -4227,25 +4228,25 @@ static void load_all_pref_files(player_type *player_ptr) { char buf[1024]; sprintf(buf, "user.prf"); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); sprintf(buf, "user-%s.prf", ANGBAND_SYS); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); sprintf(buf, "%s.prf", rp_ptr->title); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); sprintf(buf, "%s.prf", cp_ptr->title); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); sprintf(buf, "%s.prf", player_ptr->base_name); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); if (player_ptr->realm1 != REALM_NONE) { sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); } if (player_ptr->realm2 != REALM_NONE) { sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]); - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); } autopick_load_pref(player_ptr, FALSE); @@ -4268,7 +4269,7 @@ void play_game(player_type *player_ptr, bool new_game) #ifdef CHUUKEI if (chuukei_client) { - reset_visuals(); + reset_visuals(player_ptr, process_autopick_file_command); browse_chuukei(); return; } @@ -4281,7 +4282,7 @@ void play_game(player_type *player_ptr, bool new_game) if (browsing_movie) { - reset_visuals(player_ptr); + reset_visuals(player_ptr, process_autopick_file_command); browse_movie(); return; } @@ -4383,7 +4384,7 @@ void play_game(player_type *player_ptr, bool new_game) current_world_ptr->seed_flavor = randint0(0x10000000); current_world_ptr->seed_town = randint0(0x10000000); - player_birth(player_ptr); + player_birth(player_ptr, process_autopick_file_command); counts_write(player_ptr, 2, 0); player_ptr->count = 0; load = FALSE; @@ -4495,7 +4496,7 @@ void play_game(player_type *player_ptr, bool new_game) } player_ptr->playing = TRUE; - reset_visuals(player_ptr); + reset_visuals(player_ptr, process_autopick_file_command); load_all_pref_files(player_ptr); if (new_game) { diff --git a/src/init.c b/src/init.c index 0a823d169..bc7bc7ee0 100644 --- a/src/init.c +++ b/src/init.c @@ -1433,7 +1433,7 @@ static void init_angband_aux(concptr why) * if needed, in the first (?) pass through "TERM_XTRA_REACT". * */ -void init_angband(player_type *player_ptr) +void init_angband(player_type *player_ptr, void(*process_autopick_file_command)(char*)) { /*** Verify the "news" file ***/ char buf[1024]; @@ -1606,13 +1606,13 @@ void init_angband(player_type *player_ptr) strcpy(buf, "pref.prf"); /* Process that file */ - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); /* Access the "basic" system pref file */ sprintf(buf, "pref-%s.prf", ANGBAND_SYS); /* Process that file */ - process_pref_file(player_ptr, buf); + process_pref_file(player_ptr, buf, process_autopick_file_command); note(_("[初期化終了]", "[Initialization complete]")); } diff --git a/src/init.h b/src/init.h index 2886849fc..46e0af431 100644 --- a/src/init.h +++ b/src/init.h @@ -128,6 +128,6 @@ extern header g_head; extern s16b f_tag_to_index(concptr str); extern s16b f_tag_to_index_in_init(concptr str); -extern void init_angband(player_type *player_ptr); +extern void init_angband(player_type *player_ptr, void(*process_autopick_file_command)(char*)); extern concptr get_check_sum(void); extern void init_file_paths(char *path); diff --git a/src/io/read-pref-file.c b/src/io/read-pref-file.c index 42d5cc371..bf62852c8 100644 --- a/src/io/read-pref-file.c +++ b/src/io/read-pref-file.c @@ -44,7 +44,7 @@ static int auto_dump_line_num; * @param preftype prefファイルのタイプ * @return エラーコード */ -static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int preftype) +static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int preftype, void(*process_autopick_file_command)(char*)) { FILE *fp; fp = my_fopen(name, "r"); @@ -91,13 +91,13 @@ static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int p switch (preftype) { case PREF_TYPE_AUTOPICK: - (void)process_autopick_file(creature_ptr, buf + 2); + (void)process_autopick_file(creature_ptr, buf + 2, process_autopick_file_command); break; case PREF_TYPE_HISTPREF: - (void)process_histpref_file(creature_ptr, buf + 2); + (void)process_histpref_file(creature_ptr, buf + 2, process_autopick_file_command); break; default: - (void)process_pref_file(creature_ptr, buf + 2); + (void)process_pref_file(creature_ptr, buf + 2, process_autopick_file_command); break; } @@ -111,7 +111,7 @@ static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int p if (preftype != PREF_TYPE_AUTOPICK) break; - process_autopick_file_command(buf); + (*process_autopick_file_command)(buf); err = 0; } } @@ -144,16 +144,16 @@ static errr process_pref_file_aux(player_type *creature_ptr, concptr name, int p * allow conditional evaluation and filename inclusion. * */ -errr process_pref_file(player_type *creature_ptr, concptr name) +errr process_pref_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)) { char buf[1024]; path_build(buf, sizeof(buf), ANGBAND_DIR_PREF, name); - errr err1 = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_NORMAL); + errr err1 = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_NORMAL, process_autopick_file_command); if (err1 > 0) return err1; path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); - errr err2 = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_NORMAL); + errr err2 = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_NORMAL, process_autopick_file_command); if (err2 < 0 && !err1) return -2; @@ -167,11 +167,11 @@ errr process_pref_file(player_type *creature_ptr, concptr name) * @param name ファイル名 * @details */ -errr process_autopick_file(player_type *creature_ptr, concptr name) +errr process_autopick_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)) { char buf[1024]; path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); - errr err = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_AUTOPICK); + errr err = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_AUTOPICK, process_autopick_file_command); return err; } @@ -184,7 +184,7 @@ errr process_autopick_file(player_type *creature_ptr, concptr name) * @return エラーコード * @details */ -errr process_histpref_file(player_type *creature_ptr, concptr name) +errr process_histpref_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)) { bool old_character_xtra = current_world_ptr->character_xtra; char buf[1024]; @@ -192,7 +192,7 @@ errr process_histpref_file(player_type *creature_ptr, concptr name) /* Hack -- prevent modification birth options in this file */ current_world_ptr->character_xtra = TRUE; - errr err = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_HISTPREF); + errr err = process_pref_file_aux(creature_ptr, buf, PREF_TYPE_HISTPREF, process_autopick_file_command); current_world_ptr->character_xtra = old_character_xtra; return err; } diff --git a/src/io/read-pref-file.h b/src/io/read-pref-file.h index da7208b8a..4c5d92ee8 100644 --- a/src/io/read-pref-file.h +++ b/src/io/read-pref-file.h @@ -3,9 +3,9 @@ extern char auto_dump_header[]; extern char auto_dump_footer[]; -extern errr process_pref_file(player_type *creature_ptr, concptr name); -extern errr process_autopick_file(player_type *creature_ptr, concptr name); -extern errr process_histpref_file(player_type *creature_ptr, concptr name); +extern errr process_pref_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)); +extern errr process_autopick_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)); +extern errr process_histpref_file(player_type *creature_ptr, concptr name, void(*process_autopick_file_command)(char*)); void auto_dump_printf(FILE *auto_dump_stream, concptr fmt, ...); bool open_auto_dump(FILE **fpp, concptr buf, concptr mark); diff --git a/src/main-win.c b/src/main-win.c index 80f3c03ab..0cbaa0dee 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -98,6 +98,7 @@ #include "chuukei.h" #include "io/write-diary.h" +#include "autopick/autopick-pref-processor.h" #include "cmd/cmd-process-screen.h" #include "cmd/cmd-save.h" #include "view/display-main-window.h" @@ -1440,7 +1441,7 @@ static errr term_xtra_win_react(player_type *player_ptr) } use_graphics = arg_graphics; - reset_visuals(player_ptr); + reset_visuals(player_ptr, process_autopick_file_command); } for (int i = 0; i < MAX_TERM_DATA; i++) @@ -3853,7 +3854,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC signals_init(); Term_activate(term_screen); - init_angband(p_ptr); + init_angband(p_ptr, process_autopick_file_command); initialized = TRUE; #ifdef CHUUKEI if (lpCmdLine[0] == '-') { diff --git a/src/market/store.c b/src/market/store.c index de75616d1..733af48d4 100644 --- a/src/market/store.c +++ b/src/market/store.c @@ -57,6 +57,7 @@ #include "world.h" #include "object/object-kind.h" #include "autopick/autopick.h" +#include "autopick/autopick-pref-processor.h" #include "floor-town.h" #include "japanese.h" #include "view/display-main-window.h" @@ -1950,21 +1951,21 @@ static void store_process_command(player_type *client_ptr) case '@': { client_ptr->town_num = old_town_num; - do_cmd_macros(client_ptr); + do_cmd_macros(client_ptr, process_autopick_file_command); client_ptr->town_num = inner_town_num; break; } case '%': { client_ptr->town_num = old_town_num; - do_cmd_visuals(client_ptr); + do_cmd_visuals(client_ptr, process_autopick_file_command); client_ptr->town_num = inner_town_num; break; } case '&': { client_ptr->town_num = old_town_num; - do_cmd_colors(client_ptr); + do_cmd_colors(client_ptr, process_autopick_file_command); client_ptr->town_num = inner_town_num; break; } @@ -2018,7 +2019,7 @@ static void store_process_command(player_type *client_ptr) } case ')': { - do_cmd_save_screen(client_ptr, handle_stuff); + do_cmd_save_screen(client_ptr, handle_stuff, process_autopick_file_command); break; } default: diff --git a/src/monster-status.c b/src/monster-status.c index 2a12f7ec1..9114109dd 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -5,6 +5,7 @@ #include "creature.h" #include "io/write-diary.h" +#include "autopick/autopick-pref-processor.h" #include "cmd/cmd-draw.h" #include "cmd/cmd-dump.h" #include "dungeon.h" @@ -1192,7 +1193,7 @@ bool mon_take_hit(player_type *target_ptr, MONSTER_IDX m_idx, HIT_POINT dam, boo #ifdef WORLD_SCORE if (m_ptr->r_idx == MON_SERPENT) { - screen_dump = make_screen_dump(target_ptr); + screen_dump = make_screen_dump(target_ptr, process_autopick_file_command); } #endif } diff --git a/src/object.h b/src/object.h index a7b1297b3..a81a0f721 100644 --- a/src/object.h +++ b/src/object.h @@ -392,7 +392,7 @@ extern OBJECT_TYPE_VALUE item_tester_tval; extern bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx); /* object1.c */ -extern void reset_visuals(player_type *owner_ptr); +extern void reset_visuals(player_type *owner_ptr, void(*process_autopick_file_command)(char*)); extern void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE]); extern void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE]); extern concptr item_activation(object_type *o_ptr); diff --git a/src/object1.c b/src/object1.c index 36a88294f..d8b53ddea 100644 --- a/src/object1.c +++ b/src/object1.c @@ -53,7 +53,7 @@ *\n * The "prefs" parameter is no longer meaningful. \n */ -void reset_visuals(player_type *owner_ptr) +void reset_visuals(player_type *owner_ptr, void(*process_autopick_file_command)(char*)) { for (int i = 0; i < max_f_idx; i++) { @@ -82,9 +82,9 @@ void reset_visuals(player_type *owner_ptr) char *pref_file = use_graphics ? "graf.prf" : "font.prf"; char *base_name = use_graphics ? "graf-%s.prf" : "font-%s.prf"; char buf[1024]; - process_pref_file(owner_ptr, pref_file); + process_pref_file(owner_ptr, pref_file, process_autopick_file_command); sprintf(buf, base_name, owner_ptr->base_name); - process_pref_file(owner_ptr, buf); + process_pref_file(owner_ptr, buf, process_autopick_file_command); } diff --git a/src/player-damage.c b/src/player-damage.c index 0b1a0d09a..ad98771bf 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -8,6 +8,7 @@ #include "avatar.h" #include "market/building.h" #include "io/write-diary.h" +#include "autopick/autopick-pref-processor.h" #include "cmd/cmd-process-screen.h" #include "market/arena-info-table.h" #include "realm-song.h" @@ -513,7 +514,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp #ifdef WORLD_SCORE /* Make screen dump */ - screen_dump = make_screen_dump(creature_ptr); + screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command); #endif /* Note cause of death */ @@ -567,7 +568,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY)) { - do_cmd_save_screen(creature_ptr, handle_stuff); + do_cmd_save_screen(creature_ptr, handle_stuff, process_autopick_file_command); } flush(); @@ -664,7 +665,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp flush(); #ifdef WORLD_SCORE /* Make screen dump */ - screen_dump = make_screen_dump(creature_ptr); + screen_dump = make_screen_dump(creature_ptr, process_autopick_file_command); #endif /* Wait a key press */ diff --git a/src/report.c b/src/report.c index 758e0ea8f..76f0c5ae3 100644 --- a/src/report.c +++ b/src/report.c @@ -262,7 +262,7 @@ static errr make_dump(player_type *creature_ptr, BUF* dumpbuf, void(*update_play * @brief スクリーンダンプを作成する/ Make screen dump to buffer * @return 作成したスクリーンダンプの参照ポインタ */ -concptr make_screen_dump(player_type *creature_ptr) +concptr make_screen_dump(player_type *creature_ptr, void(*process_autopick_file_command)(char*)) { static concptr html_head[] = { "\n\n", @@ -290,7 +290,7 @@ concptr make_screen_dump(player_type *creature_ptr) msg_print(NULL); use_graphics = FALSE; - reset_visuals(creature_ptr); + reset_visuals(creature_ptr, process_autopick_file_command); creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); handle_stuff(creature_ptr); @@ -371,7 +371,7 @@ concptr make_screen_dump(player_type *creature_ptr) if (!old_use_graphics) return ret; use_graphics = TRUE; - reset_visuals(creature_ptr); + reset_visuals(creature_ptr, process_autopick_file_command); creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); handle_stuff(creature_ptr); diff --git a/src/report.h b/src/report.h index 4ab7e1546..e83cce8f5 100644 --- a/src/report.h +++ b/src/report.h @@ -6,5 +6,5 @@ extern concptr screen_dump; #include "files.h" extern errr report_score(player_type *creature_ptr, void(*update_playtime)(void), display_player_pf display_player, map_name_pf map_name); -extern concptr make_screen_dump(player_type *creature_ptr); +extern concptr make_screen_dump(player_type *creature_ptr, void(*process_autopick_file_command)(char*)); #endif -- 2.11.0