From 3ef4a5e71ac786870914da5ef3c8f4e9dd74ca4f Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 17 Jun 2019 23:11:03 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#39076=20=E5=86=97=E9=95=B7?= =?utf8?q?=E3=81=AA=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E5=89=8A?= =?utf8?q?=E9=99=A4=20(/*=20Build=20the=20filename=20*/)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 2 -- src/cmd-dump.c | 26 -------------------------- src/cmd-read.c | 2 -- src/core.c | 4 ---- src/dungeon-file.c | 2 -- src/files.c | 29 ----------------------------- src/init.c | 16 ---------------- src/main-win.c | 6 ------ src/scores.c | 6 ------ src/wizard1.c | 12 ------------ src/wizard2.c | 2 -- 11 files changed, 107 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index 348765925..f688d8335 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -2903,8 +2903,6 @@ static bool write_text_lines(concptr filename, concptr *lines_list) int lines = 0; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, filename); /* Open the file */ diff --git a/src/cmd-dump.c b/src/cmd-dump.c index c07d785cc..126459fa7 100644 --- a/src/cmd-dump.c +++ b/src/cmd-dump.c @@ -438,8 +438,6 @@ errr do_cmd_write_nikki(int type, int num, concptr note) /* different filne name to avoid mixing */ sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name); /* File type is "TEXT" */ @@ -831,8 +829,6 @@ static void do_cmd_disp_nikki(void) "Quest of The World's Greatest Brain"}; #endif sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name); if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER) @@ -901,8 +897,6 @@ static void do_cmd_erase_nikki(void) if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return; sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name); fd_kill(buf); @@ -1400,8 +1394,6 @@ static errr macro_dump(concptr fname) int i; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -1556,8 +1548,6 @@ static errr keymap_dump(concptr fname) mode = KEYMAP_MODE_ORIG; } - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -2154,8 +2144,6 @@ void do_cmd_visuals(void) /* Get a filename */ if (!askfor(tmp, 70)) continue; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp); /* Append to the file */ @@ -2205,8 +2193,6 @@ void do_cmd_visuals(void) /* Get a filename */ if (!askfor(tmp, 70)) continue; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp); /* Append to the file */ @@ -2272,8 +2258,6 @@ void do_cmd_visuals(void) /* Get a filename */ if (!askfor(tmp, 70)) continue; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp); /* Append to the file */ @@ -2728,8 +2712,6 @@ void do_cmd_colors(void) /* Get a filename */ if (!askfor(tmp, 70)) continue; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp); /* Append to the file */ @@ -3619,8 +3601,6 @@ void do_cmd_load_screen(void) TERM_LEN wid, hgt; Term_get_size(&wid, &hgt); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt"); /* Append to the file */ @@ -3924,8 +3904,6 @@ void do_cmd_save_screen_html_aux(char *filename, int message) return; } if (message) screen_save(); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf"); tmpfff = my_fopen(buf, "r"); if (!tmpfff) { @@ -4032,8 +4010,6 @@ static void do_cmd_save_screen_html(void) if (!get_string(_("ファイル名: ", "File name: "), tmp, 80)) return; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp); msg_print(NULL); @@ -4105,8 +4081,6 @@ void do_cmd_save_screen(void) SYMBOL_CODE c = ' '; FILE *fff; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt"); /* File type is "TEXT" */ diff --git a/src/cmd-read.c b/src/cmd-read.c index fc1be77f0..3265455f6 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -556,8 +556,6 @@ void exe_read(INVENTORY_IDX item, bool known) /* Display object description */ object_desc(o_name, o_ptr, OD_NAME_ONLY); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q); /* Peruse the help file */ diff --git a/src/core.c b/src/core.c index a5dd42e5c..87c820314 100644 --- a/src/core.c +++ b/src/core.c @@ -5314,8 +5314,6 @@ void play_game(bool new_game) /* Hack -- Character is now "icky" */ current_world_ptr->character_icky = TRUE; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Open the high score file, for reading/writing */ @@ -5783,8 +5781,6 @@ void close_game(void) /* Hack -- Character is now "icky" */ current_world_ptr->character_icky = TRUE; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Grab permissions */ diff --git a/src/dungeon-file.c b/src/dungeon-file.c index cecbeb495..4bae06474 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -4917,8 +4917,6 @@ errr process_dungeon_file(concptr name, int ymin, int xmin, int ymax, int xmax) bool bypass = FALSE; int x = xmin, y = ymin; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, name); /* Open the file */ diff --git a/src/files.c b/src/files.c index 379e61bc9..be6dd7c33 100644 --- a/src/files.c +++ b/src/files.c @@ -1274,8 +1274,6 @@ errr process_pref_file(concptr name) char buf[1024]; errr err1, err2; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_PREF, name); /* Process the system pref file */ @@ -1284,8 +1282,6 @@ errr process_pref_file(concptr name) /* Stop at parser errors, but not at non-existing file */ if (err1 > 0) return err1; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); /* Process the user pref file */ @@ -1370,8 +1366,6 @@ errr check_time_init(void) char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "time.txt"); /* Open the file */ @@ -1496,8 +1490,6 @@ errr check_load_init(void) char temphost[MAXHOSTNAMELEN+1]; char thishost[MAXHOSTNAMELEN+1]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "load.txt"); /* Open the "load" file */ @@ -5051,8 +5043,6 @@ errr file_character(concptr name) int fd = -1; FILE *fff = NULL; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); /* File type is "TEXT" */ @@ -5352,8 +5342,6 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG { /* Caption */ sprintf(caption, _("ヘルプ・ファイル'%s'", "Help file '%s'"), name); - - /* Build the filename */ path_build(path, sizeof(path), ANGBAND_DIR_HELP, name); /* Open the file */ @@ -5365,8 +5353,6 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG { /* Caption */ sprintf(caption, _("スポイラー・ファイル'%s'", "Info file '%s'"), name); - - /* Build the filename */ path_build(path, sizeof(path), ANGBAND_DIR_INFO, name); /* Open the file */ @@ -5376,7 +5362,6 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG /* Look in "info" */ if (!fff) { - /* Build the filename */ path_build(path, sizeof(path), ANGBAND_DIR, name); for (i = 0; path[i]; i++) @@ -5744,8 +5729,6 @@ bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAG if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) continue; my_fclose(fff); - - /* Build the filename */ path_build(buff, sizeof(buff), ANGBAND_DIR_USER, xtmp); /* Hack -- Re-Open the file */ @@ -5953,8 +5936,6 @@ void process_player_name(bool sf) /* Rename the savefile, using the p_ptr->base_name */ (void)sprintf(temp, "%s", p_ptr->base_name); #endif - - /* Build the filename */ path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp); } @@ -6148,8 +6129,6 @@ static void make_bones(void) /* "Bones" name */ sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level); - - /* Build the filename */ path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp); /* Attempt to open the bones file */ @@ -6226,8 +6205,6 @@ void print_tomb(void) int extra_line = 0; #endif Term_clear(); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("dead_j.txt", "dead.txt")); /* Open the News file */ @@ -6620,8 +6597,6 @@ errr get_rnd_line(concptr file_name, int entry, char *output) int counter, test; int line_num = 0; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, file_name); /* Open the file */ @@ -6749,8 +6724,6 @@ errr process_autopick_file(concptr name) char buf[1024]; errr err = 0; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); err = process_pref_file_aux(buf, PREF_TYPE_AUTOPICK); @@ -6770,8 +6743,6 @@ errr process_histpref_file(concptr name) char buf[1024]; errr err = 0; bool old_character_xtra = current_world_ptr->character_xtra; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name); /* Hack -- prevent modification birth options in this file */ diff --git a/src/init.c b/src/init.c index 0db527771..95e9671dd 100644 --- a/src/init.c +++ b/src/init.c @@ -312,8 +312,6 @@ static errr check_modification_date(int fd, concptr template_file) char buf[1024]; struct stat txt_stat, raw_stat; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file); /* Access stats on text file */ @@ -477,8 +475,6 @@ static errr init_info(concptr filename, header *head, #ifdef ALLOW_TEMPLATES /*** Load the binary image file ***/ - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); @@ -521,8 +517,6 @@ static errr init_info(concptr filename, header *head, /*** Load the ascii template file ***/ - /* Build the filename */ - path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename)); /* Open the file */ @@ -579,8 +573,6 @@ static errr init_info(concptr filename, header *head, /* File type is "DATA" */ FILE_TYPE(FILE_TYPE_DATA); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); @@ -633,8 +625,6 @@ static errr init_info(concptr filename, header *head, /*** Load the binary image file ***/ - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format(_("%s_j.raw", "%s.raw"), filename)); /* Attempt to open the "raw" file */ @@ -1728,8 +1718,6 @@ void init_angband(void) /*** Verify the "news" file ***/ - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); /* Attempt to open the file */ @@ -1750,8 +1738,6 @@ void init_angband(void) /*** Display the "news" file ***/ Term_clear(); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); /* Open the News file */ @@ -1778,8 +1764,6 @@ void init_angband(void) /*** Verify (or create) the "high score" file ***/ - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Attempt to open the high score file */ diff --git a/src/main-win.c b/src/main-win.c index 964a8186c..245beef50 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -3982,8 +3982,6 @@ static void process_menus(WORD wCmd) case IDM_FILE_SCORE: { char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Open the binary high score file, for reading */ @@ -5590,8 +5588,6 @@ static void init_stuff(void) validate_dir(ANGBAND_DIR_SAVE, FALSE); validate_dir(ANGBAND_DIR_USER, TRUE); validate_dir(ANGBAND_DIR_XTRA, TRUE); - - /* Build the filename */ path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt")); /* Hack -- Validate the "news.txt" file */ @@ -5607,8 +5603,6 @@ static void init_stuff(void) /* Validate the "font" directory */ validate_dir(ANGBAND_DIR_XTRA_FONT, TRUE); - - /* Build the filename */ path_build(path, sizeof(path), ANGBAND_DIR_XTRA_FONT, "8X13.FON"); /* Hack -- Validate the basic font */ diff --git a/src/scores.c b/src/scores.c index 1626e7010..a15b12086 100644 --- a/src/scores.c +++ b/src/scores.c @@ -407,8 +407,6 @@ void display_scores_aux(int from, int to, int note, high_score *score) void display_scores(int from, int to) { char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); /* Open the binary high score file, for reading */ @@ -688,8 +686,6 @@ void show_highclass(void) char buf[1024], out_val[256]; screen_save(); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); highscore_fd = fd_open(buf, O_RDONLY); @@ -769,8 +765,6 @@ void race_score(int race_num) sprintf(tmp_str,_("最高の%s", "The Greatest of all the %s"), race_info[race_num].title); prt(tmp_str, 5, 15); - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw"); highscore_fd = fd_open(buf, O_RDONLY); diff --git a/src/wizard1.c b/src/wizard1.c index 0233f1fa9..79c7b3420 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -311,8 +311,6 @@ static void spoil_obj_desc(concptr fname) char chance[80]; char dam[80]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -1606,8 +1604,6 @@ static void spoil_artifact(concptr fname) object_type *q_ptr; obj_desc_list artifact; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -1690,8 +1686,6 @@ static void spoil_mon_desc(concptr fname) char ac[80]; char hp[80]; char exp[80]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -2024,8 +2018,6 @@ static void spoil_mon_info(concptr fname) u16b why = 2; MONRACE_IDX *who; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -2232,8 +2224,6 @@ static void spoil_mon_evol(concptr fname) monster_race *r_ptr; int **evol_tree, i, j, n, r_idx; int *evol_tree_zero; /* For C_KILL() */ - - /* Build the filename */ path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ @@ -2530,8 +2520,6 @@ void spoil_random_artifact(concptr fname) object_type *q_ptr; char buf[1024]; - - /* Build the filename */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); /* File type is "TEXT" */ diff --git a/src/wizard2.c b/src/wizard2.c index 515df089f..d09876e78 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1590,8 +1590,6 @@ static void do_cmd_dump_options(void) FILE *fff; char buf[1024]; int **exist; - - /* Build the filename */ path_build(buf, sizeof buf, ANGBAND_DIR_USER, "opt_info.txt"); /* File type is "TEXT" */ -- 2.11.0