From aa2a23ea768c9bd91b80a66f6c72d73d9bf6e82e Mon Sep 17 00:00:00 2001 From: deskull Date: Sun, 21 Apr 2019 17:31:10 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20externs.h=20=E3=81=8B?= =?utf8?q?=E3=82=89=20util.h=20=E3=81=B8=E3=81=AE=E5=AE=A3=E8=A8=80?= =?utf8?q?=E7=A7=BB=E5=8B=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 1 + Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 1 + src/Makefile.am | 2 +- src/artifact.c | 2 + src/autopick.c | 2 + src/birth.c | 2 + src/bldg.c | 2 + src/chest.c | 2 + src/chuukei.c | 2 + src/cmd-activate.c | 2 + src/cmd-basic.c | 2 + src/cmd-eat.c | 2 + src/cmd-hissatsu.c | 2 + src/cmd-item.c | 2 + src/cmd-magiceat.c | 2 + src/cmd-mane.c | 2 + src/cmd-pet.c | 2 + src/cmd-quaff.c | 2 + src/cmd-read.c | 2 + src/cmd-smith.c | 2 + src/cmd-spell.c | 2 + src/cmd-usestaff.c | 2 + src/cmd-zaprod.c | 2 + src/cmd-zapwand.c | 2 + src/cmd4.c | 2 + src/dungeon-file.c | 2 + src/dungeon.c | 2 + src/externs.h | 82 --------------------- src/files.c | 2 + src/floor-events.c | 2 + src/floor-generate.c | 2 + src/floor-save.c | 2 + src/floor-streams.c | 2 + src/grid.c | 2 + src/inet.c | 2 + src/init.c | 1 + src/japanese.c | 1 + src/load.c | 2 + src/main-win.c | 2 + src/melee1.c | 2 + src/mind.c | 2 + src/monster-process.c | 2 + src/monster-status.c | 2 + src/monster1.c | 2 + src/monster2.c | 2 + src/monsterrace-hook.c | 2 + src/mspells1.c | 2 + src/mspells2.c | 2 + src/mspells3.c | 2 + src/mspells4.c | 2 + src/mutation.c | 2 + src/object-curse.c | 2 + src/object-flavor.c | 2 + src/object-hook.c | 2 + src/object1.c | 2 + src/object2.c | 2 + src/patron.c | 1 + src/player-damage.c | 2 + src/player-effects.c | 2 + src/player-move.c | 2 + src/player-status.c | 2 + src/quest.c | 2 + src/racial.c | 2 + src/realm-arcane.c | 2 + src/realm-chaos.c | 2 + src/realm-craft.c | 2 + src/realm-crusade.c | 2 + src/realm-daemon.c | 2 + src/realm-hex.c | 2 + src/realm-hissatsu.c | 2 + src/realm-nature.c | 2 + src/realm-song.c | 2 + src/realm-sorcery.c | 2 + src/realm-trump.c | 2 + src/report.c | 2 + src/rooms-city.c | 2 + src/rooms-pitnest.c | 2 + src/rooms-special.c | 2 + src/rooms-trap.c | 2 + src/rooms-vault.c | 2 + src/rooms.c | 2 + src/rumor.c | 2 + src/save.c | 2 + src/scores.c | 2 + src/selfinfo.c | 2 + src/shoot.c | 2 + src/snipe.c | 2 + src/spells-floor.c | 2 + src/spells-object.c | 2 + src/spells-status.c | 2 + src/spells-summon.c | 2 + src/spells-world.c | 1 + src/spells1.c | 2 + src/spells2.c | 2 + src/spells3.c | 2 + src/store.c | 2 + src/term.c | 2 + src/trap.c | 2 + src/util.c | 1 + src/util.h | 83 ++++++++++++++++++++++ src/view-mainwindow.c | 2 + src/warning.c | 2 + src/wild.c | 2 + src/wizard1.c | 2 + src/wizard2.c | 1 + src/xtra2.c | 2 + 106 files changed, 282 insertions(+), 83 deletions(-) create mode 100644 src/util.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index 59c67cb41..2210979a6 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -365,6 +365,7 @@ + diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 460d530b3..d655f2258 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -586,6 +586,7 @@ spells + diff --git a/src/Makefile.am b/src/Makefile.am index 7fb527d6f..4374d7dbd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -83,7 +83,7 @@ hengband_SOURCES = \ spells-world.c spells-world.h \ \ sort.c sort.h \ - store.h store.c tables.c trap.c trap.h types.h util.c \ + store.h store.c tables.c trap.c trap.h types.h util.c util.h \ variable.c wild.h wild.c wizard1.c wizard2.c \ warning.c warning.h world.c world.h \ \ diff --git a/src/artifact.c b/src/artifact.c index 16398f9f4..7c8515d11 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "artifact.h" #include "avatar.h" diff --git a/src/autopick.c b/src/autopick.c index 8a980eb90..157039154 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "store.h" #include "player-status.h" #include "player-move.h" diff --git a/src/birth.c b/src/birth.c index 344babcad..963658d67 100644 --- a/src/birth.c +++ b/src/birth.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "avatar.h" #include "history.h" #include "monsterrace-hook.h" diff --git a/src/bldg.c b/src/bldg.c index 4371eb1c3..01ef17f33 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -13,6 +13,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "floor-events.h" #include "floor-save.h" diff --git a/src/chest.c b/src/chest.c index be86cbad5..6725e5868 100644 --- a/src/chest.c +++ b/src/chest.c @@ -1,5 +1,7 @@  #include "angband.h" +#include "util.h" + #include "spells.h" #include "spells-summon.h" #include "floor.h" diff --git a/src/chuukei.c b/src/chuukei.c index 840e0383b..1dfbf4173 100644 --- a/src/chuukei.c +++ b/src/chuukei.c @@ -8,6 +8,8 @@ #include "angband.h" +#include "util.h" + #include #include #include diff --git a/src/cmd-activate.c b/src/cmd-activate.c index fb715b41d..d44ab5bb1 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -7,6 +7,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-activate.h" #include "cmd-basic.h" #include "floor.h" diff --git a/src/cmd-basic.c b/src/cmd-basic.c index fb252c62d..c932dd700 100644 --- a/src/cmd-basic.c +++ b/src/cmd-basic.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "chest.h" #include "trap.h" #include "floor.h" diff --git a/src/cmd-eat.c b/src/cmd-eat.c index b24e3d64e..576aa64d9 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -8,6 +8,8 @@ #include "angband.h" +#include "util.h" + #include "object-flavor.h" #include "object-hook.h" #include "avatar.h" diff --git a/src/cmd-hissatsu.c b/src/cmd-hissatsu.c index 79b2f9505..4091b3cca 100644 --- a/src/cmd-hissatsu.c +++ b/src/cmd-hissatsu.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "monsterrace-hook.h" #include "player-status.h" #include "player-effects.h" diff --git a/src/cmd-item.c b/src/cmd-item.c index 4bc0bc0e4..5c026bfc2 100644 --- a/src/cmd-item.c +++ b/src/cmd-item.c @@ -12,6 +12,8 @@ #include "angband.h" +#include "util.h" + #include "selfinfo.h" #include "cmd-activate.h" #include "cmd-eat.h" diff --git a/src/cmd-magiceat.c b/src/cmd-magiceat.c index f27723331..3ddb58bca 100644 --- a/src/cmd-magiceat.c +++ b/src/cmd-magiceat.c @@ -53,6 +53,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-basic.h" #include "cmd-usestaff.h" #include "cmd-zaprod.h" diff --git a/src/cmd-mane.c b/src/cmd-mane.c index 2befe2f47..37ee4b73c 100644 --- a/src/cmd-mane.c +++ b/src/cmd-mane.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "spells.h" diff --git a/src/cmd-pet.c b/src/cmd-pet.c index e92c2c763..eeb758331 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "melee.h" diff --git a/src/cmd-quaff.c b/src/cmd-quaff.c index 8f7dcfcf1..3c88fbb48 100644 --- a/src/cmd-quaff.c +++ b/src/cmd-quaff.c @@ -7,6 +7,8 @@ */ #include "angband.h" +#include "util.h" + #include "birth.h" #include "selfinfo.h" #include "object-hook.h" diff --git a/src/cmd-read.c b/src/cmd-read.c index 70abc84e8..fc4a641d7 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -7,6 +7,8 @@ */ #include "angband.h" +#include "util.h" + #include "object-flavor.h" #include "object-hook.h" #include "artifact.h" diff --git a/src/cmd-smith.c b/src/cmd-smith.c index 5b701fba0..06b00b647 100644 --- a/src/cmd-smith.c +++ b/src/cmd-smith.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "object-flavor.h" #include "object-hook.h" #include "player-status.h" diff --git a/src/cmd-spell.c b/src/cmd-spell.c index b639148a9..35e573b16 100644 --- a/src/cmd-spell.c +++ b/src/cmd-spell.c @@ -7,6 +7,8 @@ */ #include "angband.h" +#include "util.h" + #include "selfinfo.h" #include "spells-summon.h" #include "realm-arcane.h" diff --git a/src/cmd-usestaff.c b/src/cmd-usestaff.c index 1472dafee..defeb5235 100644 --- a/src/cmd-usestaff.c +++ b/src/cmd-usestaff.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "spells-summon.h" #include "avatar.h" #include "player-status.h" diff --git a/src/cmd-zaprod.c b/src/cmd-zaprod.c index de99f2888..6fdfc942b 100644 --- a/src/cmd-zaprod.c +++ b/src/cmd-zaprod.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "avatar.h" #include "player-status.h" #include "player-effects.h" diff --git a/src/cmd-zapwand.c b/src/cmd-zapwand.c index 6de7b4195..3fd90c8c0 100644 --- a/src/cmd-zapwand.c +++ b/src/cmd-zapwand.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "avatar.h" #include "spells.h" #include "spells-status.h" diff --git a/src/cmd4.c b/src/cmd4.c index 7f15e9086..ee8b75aae 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -40,6 +40,8 @@ */ #include "angband.h" +#include "util.h" + #include "birth.h" #include "cmd-pet.h" #include "cmd-spell.h" diff --git a/src/dungeon-file.c b/src/dungeon-file.c index e06a98538..0f5c40e53 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -1,5 +1,7 @@  #include "angband.h" +#include "util.h" + #include "dungeon-file.h" #include "grid.h" #include "quest.h" diff --git a/src/dungeon.c b/src/dungeon.c index 2ce251884..9129298d3 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "birth.h" #include "cmd-activate.h" #include "cmd-eat.h" diff --git a/src/externs.h b/src/externs.h index f55973ee7..44e7fd11c 100644 --- a/src/externs.h +++ b/src/externs.h @@ -780,88 +780,6 @@ extern HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow); extern HIT_POINT calc_expect_crit_shot(WEIGHT weight, int plus_ammo,int plus_bow, HIT_POINT dam); extern HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari); -/* util.c */ -extern errr path_parse(char *buf, int max, concptr file); -extern errr path_build(char *buf, int max, concptr path, concptr file); -extern FILE *my_fopen(concptr file, concptr mode); -extern FILE *my_fopen_temp(char *buf, int max); -extern errr my_fgets(FILE *fff, char *buf, huge n); -extern errr my_fputs(FILE *fff, concptr buf, huge n); -extern errr my_fclose(FILE *fff); -extern errr fd_kill(concptr file); -extern errr fd_move(concptr file, concptr what); -extern errr fd_copy(concptr file, concptr what); -extern int fd_make(concptr file, BIT_FLAGS mode); -extern int fd_open(concptr file, int flags); -extern errr fd_lock(int fd, int what); -extern errr fd_seek(int fd, huge n); -extern errr fd_chop(int fd, huge n); -extern errr fd_read(int fd, char *buf, huge n); -extern errr fd_write(int fd, concptr buf, huge n); -extern errr fd_close(int fd); -extern void flush(void); -extern void bell(void); -extern errr play_music(int type, int num); -extern void select_floor_music(void); -extern void sound(int num); -extern void move_cursor(int row, int col); -extern void text_to_ascii(char *buf, concptr str); -extern void ascii_to_text(char *buf, concptr str); -extern errr macro_add(concptr pat, concptr act); -extern sint macro_find_exact(concptr pat); -extern char inkey(void); -extern concptr quark_str(STR_OFFSET num); -extern void quark_init(void); -extern u16b quark_add(concptr str); -extern s32b message_num(void); -extern concptr message_str(int age); -extern void message_add(concptr msg); -extern void msg_erase(void); -extern void msg_print(concptr msg); -extern void msg_print_wizard(int cheat_type, concptr msg); -#ifndef SWIG -extern void msg_format(concptr fmt, ...); -extern void msg_format_wizard(int cheat_type, concptr fmt, ...); -#endif /* SWIG */ -extern void screen_save(void); -extern void screen_load(void); -extern void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col); -extern void put_str(concptr str, TERM_LEN row, TERM_LEN col); -extern void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col); -extern void prt(concptr str, TERM_LEN row, TERM_LEN col); -extern void c_roff(TERM_COLOR attr, concptr str); -extern void roff(concptr str); -extern void clear_from(int row); -extern bool askfor_aux(char *buf, int len, bool numpad_cursor); -extern bool askfor(char *buf, int len); -extern bool get_string(concptr prompt, char *buf, int len); -extern bool get_check(concptr prompt); -extern bool get_check_strict(concptr prompt, BIT_FLAGS mode); -extern bool get_com(concptr prompt, char *command, bool z_escape); -extern QUANTITY get_quantity(concptr prompt, QUANTITY max); -extern void pause_line(int row); -extern void request_command(int shopping); -extern bool is_a_vowel(int ch); -extern int get_keymap_dir(char ch); -extern errr type_string(concptr str, uint len); -extern void roff_to_buf(concptr str, int wlen, char *tbuf, size_t bufsize); - -#ifdef SORT_R_INFO -extern void tag_sort(tag_type elements[], int number); -#endif /* SORT_R_INFO */ - -#ifdef SUPPORT_GAMMA -extern byte gamma_table[256]; -extern void build_gamma_table(int gamma); -#endif /* SUPPORT_GAMMA */ - -extern size_t my_strcpy(char *buf, concptr src, size_t bufsize); -extern size_t my_strcat(char *buf, concptr src, size_t bufsize); -extern char *my_strstr(concptr haystack, concptr needle); -extern char *my_strchr(concptr ptr, char ch); -extern void str_tolower(char *str); -extern int inkey_special(bool numpad_cursor); - /* xtra1.c */ extern int bow_tval_ammo(object_type *o_ptr); diff --git a/src/files.c b/src/files.c index 7b12b0425..dd43f6e33 100644 --- a/src/files.c +++ b/src/files.c @@ -14,6 +14,8 @@ #include "angband.h" +#include "util.h" + #include "birth.h" #include "files.h" diff --git a/src/floor-events.c b/src/floor-events.c index f030cbdf5..395bf9668 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "floor-events.h" #include "grid.h" diff --git a/src/floor-generate.c b/src/floor-generate.c index 6f5202547..9bfe9bffe 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -97,6 +97,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor-generate.h" #include "grid.h" #include "rooms.h" diff --git a/src/floor-save.c b/src/floor-save.c index 4dea41064..c51a3c149 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "floor-events.h" #include "floor-generate.h" diff --git a/src/floor-streams.c b/src/floor-streams.c index 0bc5fe9f4..226c64a71 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -16,6 +16,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor-generate.h" #include "floor.h" #include "floor-streams.h" diff --git a/src/grid.c b/src/grid.c index 028a45965..44cf74106 100644 --- a/src/grid.c +++ b/src/grid.c @@ -18,6 +18,8 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "world.h" #include "object-flavor.h" diff --git a/src/inet.c b/src/inet.c index 3202ef9ad..d45198a32 100644 --- a/src/inet.c +++ b/src/inet.c @@ -1,6 +1,8 @@ /* File: inet.c */ #include "angband.h" +#include "util.h" + #ifdef WORLD_SCORE diff --git a/src/init.c b/src/init.c index c1c71eb0c..10c59d712 100644 --- a/src/init.c +++ b/src/init.c @@ -33,6 +33,7 @@ */ #include "angband.h" +#include "util.h" #include "init.h" #include "quest.h" diff --git a/src/japanese.c b/src/japanese.c index 4e0c0b1a2..1706c0d4b 100644 --- a/src/japanese.c +++ b/src/japanese.c @@ -5,6 +5,7 @@ */ #include "angband.h" +#include "util.h" #ifdef JP diff --git a/src/load.c b/src/load.c index bcf31af68..5f994c6b4 100644 --- a/src/load.c +++ b/src/load.c @@ -41,6 +41,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor-generate.h" #include "trap.h" #include "mutation.h" diff --git a/src/main-win.c b/src/main-win.c index bb4565a6a..d21c8d172 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -98,6 +98,8 @@ */ #include "angband.h" +#include "util.h" + #include "view-mainwindow.h" #include "floor-events.h" #include "init.h" diff --git a/src/melee1.c b/src/melee1.c index bfb7a6a4d..e6d91d763 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "artifact.h" #include "cmd-pet.h" #include "player-damage.h" diff --git a/src/mind.c b/src/mind.c index 89d68ca42..e0148e5c1 100644 --- a/src/mind.c +++ b/src/mind.c @@ -15,6 +15,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "melee.h" #include "spells.h" diff --git a/src/monster-process.c b/src/monster-process.c index c1b6443bd..2f80d967f 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -14,6 +14,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "melee.h" #include "spells.h" diff --git a/src/monster-status.c b/src/monster-status.c index 432d6b441..4e1f45f7c 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "monster.h" diff --git a/src/monster1.c b/src/monster1.c index b67086ba8..04a84b0e1 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "floor.h" #include "objectkind-hook.h" diff --git a/src/monster2.c b/src/monster2.c index 4b0224f73..612ccedad 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "floor.h" #include "object-flavor.h" diff --git a/src/monsterrace-hook.c b/src/monsterrace-hook.c index 632029527..3f56104fb 100644 --- a/src/monsterrace-hook.c +++ b/src/monsterrace-hook.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "monsterrace-hook.h" #include "monster.h" #include "monster-spell.h" diff --git a/src/mspells1.c b/src/mspells1.c index a5b428940..cafd043e3 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -39,6 +39,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "object-curse.h" diff --git a/src/mspells2.c b/src/mspells2.c index 80998ff5f..3502be0c8 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "floor.h" #include "grid.h" diff --git a/src/mspells3.c b/src/mspells3.c index 2fef51b48..3214a1aee 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "spells-summon.h" diff --git a/src/mspells4.c b/src/mspells4.c index d33f6cf32..41851947f 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -7,6 +7,8 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "spells-summon.h" diff --git a/src/mutation.c b/src/mutation.c index ed16364d6..d02daf60a 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "mutation.h" #include "selfinfo.h" diff --git a/src/object-curse.c b/src/object-curse.c index 89fb976ab..4eae719f9 100644 --- a/src/object-curse.c +++ b/src/object-curse.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "object-flavor.h" #include "object-hook.h" diff --git a/src/object-flavor.c b/src/object-flavor.c index 4a54e8680..59f756ae7 100644 --- a/src/object-flavor.c +++ b/src/object-flavor.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "player-status.h" #include "shoot.h" #include "object-hook.h" diff --git a/src/object-hook.c b/src/object-hook.c index 604de693e..4aee8e881 100644 --- a/src/object-hook.c +++ b/src/object-hook.c @@ -1,5 +1,7 @@  #include "angband.h" +#include "util.h" + #include "object-hook.h" #include "monster.h" #include "artifact.h" diff --git a/src/object1.c b/src/object1.c index 563b1e8cd..f7dc6a826 100644 --- a/src/object1.c +++ b/src/object1.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "artifact.h" #include "floor.h" #include "cmd-activate.h" diff --git a/src/object2.c b/src/object2.c index eeada01cb..3a9c12a02 100644 --- a/src/object2.c +++ b/src/object2.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "grid.h" #include "object-boost.h" diff --git a/src/patron.c b/src/patron.c index 96b9dbed0..8d6cb4af4 100644 --- a/src/patron.c +++ b/src/patron.c @@ -1,5 +1,6 @@  #include "angband.h" +#include "util.h" #include "patron.h" #include "cmd-pet.h" diff --git a/src/player-damage.c b/src/player-damage.c index 06e3a67b5..365966842 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "player-damage.h" #include "artifact.h" #include "object-flavor.h" diff --git a/src/player-effects.c b/src/player-effects.c index 49ce304b3..04ebf16c6 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -13,6 +13,8 @@ */ #include "angband.h" +#include "util.h" + #include "birth.h" #include "grid.h" #include "mutation.h" diff --git a/src/player-move.c b/src/player-move.c index 052326b1f..72e14b485 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -140,6 +140,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "melee.h" #include "grid.h" diff --git a/src/player-status.c b/src/player-status.c index 65893e529..8ab830385 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "player-move.h" #include "player-status.h" #include "floor.h" diff --git a/src/quest.c b/src/quest.c index 751c879e2..5feb72531 100644 --- a/src/quest.c +++ b/src/quest.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "floor-save.h" #include "floor-events.h" diff --git a/src/racial.c b/src/racial.c index 1bf843b27..091802961 100644 --- a/src/racial.c +++ b/src/racial.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-basic.h" #include "cmd-magiceat.h" #include "cmd-mane.h" diff --git a/src/realm-arcane.c b/src/realm-arcane.c index aa9ef5d2b..bbd5a0a47 100644 --- a/src/realm-arcane.c +++ b/src/realm-arcane.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "avatar.h" diff --git a/src/realm-chaos.c b/src/realm-chaos.c index 0d60e6d48..05ef21a40 100644 --- a/src/realm-chaos.c +++ b/src/realm-chaos.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "player-effects.h" #include "spells-summon.h" diff --git a/src/realm-craft.c b/src/realm-craft.c index ada2e8a3c..39444b880 100644 --- a/src/realm-craft.c +++ b/src/realm-craft.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "selfinfo.h" #include "spells-object.h" diff --git a/src/realm-crusade.c b/src/realm-crusade.c index 7359c1426..ee93e8461 100644 --- a/src/realm-crusade.c +++ b/src/realm-crusade.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "floor.h" #include "spells.h" diff --git a/src/realm-daemon.c b/src/realm-daemon.c index 7502bfaa0..b2d672fed 100644 --- a/src/realm-daemon.c +++ b/src/realm-daemon.c @@ -1,5 +1,7 @@  #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "spells.h" #include "spells-summon.h" diff --git a/src/realm-hex.c b/src/realm-hex.c index 9491d1fd9..8ae967539 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -16,6 +16,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "cmd-spell.h" #include "cmd-quaff.h" diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 481f9eec4..70bea47ff 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "cmd-basic.h" #include "floor.h" diff --git a/src/realm-nature.c b/src/realm-nature.c index 6896249b7..b11208e97 100644 --- a/src/realm-nature.c +++ b/src/realm-nature.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "spells.h" #include "spells-summon.h" diff --git a/src/realm-song.c b/src/realm-song.c index bf6233a2d..a3a5bcaa4 100644 --- a/src/realm-song.c +++ b/src/realm-song.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "spells.h" #include "spells-status.h" diff --git a/src/realm-sorcery.c b/src/realm-sorcery.c index c10c1d326..d7de405c2 100644 --- a/src/realm-sorcery.c +++ b/src/realm-sorcery.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "selfinfo.h" #include "avatar.h" diff --git a/src/realm-trump.c b/src/realm-trump.c index e5574339d..e06289311 100644 --- a/src/realm-trump.c +++ b/src/realm-trump.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "cmd-spell.h" #include "mutation.h" #include "spells.h" diff --git a/src/report.c b/src/report.c index 730c04d27..d02434fd7 100644 --- a/src/report.c +++ b/src/report.c @@ -7,6 +7,8 @@ #define _GNU_SOURCE /*!< 未使用*/ #include "angband.h" +#include "util.h" + #include "floor.h" #include "player-status.h" #include "files.h" diff --git a/src/rooms-city.c b/src/rooms-city.c index f4e1f500b..5634d24e6 100644 --- a/src/rooms-city.c +++ b/src/rooms-city.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "grid.h" #include "floor-generate.h" #include "rooms.h" diff --git a/src/rooms-pitnest.c b/src/rooms-pitnest.c index 3a5834e14..9688e9032 100644 --- a/src/rooms-pitnest.c +++ b/src/rooms-pitnest.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "grid.h" #include "floor-generate.h" #include "rooms.h" diff --git a/src/rooms-special.c b/src/rooms-special.c index 7125e6325..1e7f0b60e 100644 --- a/src/rooms-special.c +++ b/src/rooms-special.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "grid.h" #include "floor-generate.h" #include "rooms.h" diff --git a/src/rooms-trap.c b/src/rooms-trap.c index cb59f8fc8..3c807ead4 100644 --- a/src/rooms-trap.c +++ b/src/rooms-trap.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "grid.h" #include "floor-generate.h" #include "rooms.h" diff --git a/src/rooms-vault.c b/src/rooms-vault.c index 2d5e7100c..df5d809d6 100644 --- a/src/rooms-vault.c +++ b/src/rooms-vault.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor-generate.h" #include "grid.h" #include "rooms.h" diff --git a/src/rooms.c b/src/rooms.c index 74f4c17ff..02bcb80b5 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -37,6 +37,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "floor-generate.h" #include "grid.h" diff --git a/src/rumor.c b/src/rumor.c index 5579e5c57..e5d2e037f 100644 --- a/src/rumor.c +++ b/src/rumor.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "files.h" #include "object-flavor.h" diff --git a/src/save.c b/src/save.c index 6f8367550..36b216b8c 100644 --- a/src/save.c +++ b/src/save.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "sort.h" #include "quest.h" #include "store.h" diff --git a/src/scores.c b/src/scores.c index f16dbdf00..c9961cbb0 100644 --- a/src/scores.c +++ b/src/scores.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "player-status.h" #include "files.h" #include "scores.h" diff --git a/src/selfinfo.c b/src/selfinfo.c index 04510cb91..b5643361e 100644 --- a/src/selfinfo.c +++ b/src/selfinfo.c @@ -15,6 +15,8 @@ */ #include "angband.h" +#include "util.h" + #include "player-status.h" #include "avatar.h" #include "realm-hex.h" diff --git a/src/shoot.c b/src/shoot.c index bc63d1226..edb107c74 100644 --- a/src/shoot.c +++ b/src/shoot.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "monster.h" #include "monster-status.h" #include "monster-spell.h" diff --git a/src/snipe.c b/src/snipe.c index b400b4ee6..b339b514c 100644 --- a/src/snipe.c +++ b/src/snipe.c @@ -7,6 +7,8 @@ */ #include "angband.h" +#include "util.h" + #include "player-status.h" #include "cmd-basic.h" #include "snipe.h" diff --git a/src/spells-floor.c b/src/spells-floor.c index 7b5dddae5..1ec0341d5 100644 --- a/src/spells-floor.c +++ b/src/spells-floor.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "floor.h" #include "spells-floor.h" #include "grid.h" diff --git a/src/spells-object.c b/src/spells-object.c index 1f64ef0aa..e55af59b7 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -1,5 +1,7 @@  #include "angband.h" +#include "util.h" + #include "artifact.h" #include "floor.h" #include "grid.h" diff --git a/src/spells-status.c b/src/spells-status.c index b8b8a42ee..cf9a09503 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "avatar.h" #include "floor.h" #include "object-flavor.h" diff --git a/src/spells-summon.c b/src/spells-summon.c index 4acf80ae4..6308034f8 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "spells-summon.h" #include "monster-status.h" diff --git a/src/spells-world.c b/src/spells-world.c index 2c34fd277..bf0868e13 100644 --- a/src/spells-world.c +++ b/src/spells-world.c @@ -1,4 +1,5 @@ #include "angband.h" +#include "util.h" /*! * @brief プレイ日数を変更する / Set gametime. diff --git a/src/spells1.c b/src/spells1.c index c00688d6a..da0020c6b 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "floor.h" #include "trap.h" diff --git a/src/spells2.c b/src/spells2.c index 8838c5a27..fb62491c3 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "floor.h" #include "grid.h" diff --git a/src/spells3.c b/src/spells3.c index b34108afb..e382dfcb3 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -12,6 +12,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "object-boost.h" #include "object-flavor.h" diff --git a/src/store.c b/src/store.c index 0390f6267..211ecde23 100644 --- a/src/store.c +++ b/src/store.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "cmd-item.h" #include "cmd-smith.h" diff --git a/src/term.c b/src/term.c index a77dbc5f4..34bb8921a 100644 --- a/src/term.c +++ b/src/term.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "term.h" #include "spells.h" diff --git a/src/trap.c b/src/trap.c index 48885e9c2..6392bb10f 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,6 @@ #include "angband.h" +#include "util.h" + #include "trap.h" #include "player-damage.h" #include "player-move.h" diff --git a/src/util.c b/src/util.c index ae1cd5b0e..342017ee6 100644 --- a/src/util.c +++ b/src/util.c @@ -11,6 +11,7 @@ /* Purpose: Angband utilities -BEN- */ #include "angband.h" +#include "util.h" #include "monsterrace-hook.h" #include "quest.h" diff --git a/src/util.h b/src/util.h new file mode 100644 index 000000000..e55ccff1e --- /dev/null +++ b/src/util.h @@ -0,0 +1,83 @@ +#pragma once + +/* util.c */ +extern errr path_parse(char *buf, int max, concptr file); +extern errr path_build(char *buf, int max, concptr path, concptr file); +extern FILE *my_fopen(concptr file, concptr mode); +extern FILE *my_fopen_temp(char *buf, int max); +extern errr my_fgets(FILE *fff, char *buf, huge n); +extern errr my_fputs(FILE *fff, concptr buf, huge n); +extern errr my_fclose(FILE *fff); +extern errr fd_kill(concptr file); +extern errr fd_move(concptr file, concptr what); +extern errr fd_copy(concptr file, concptr what); +extern int fd_make(concptr file, BIT_FLAGS mode); +extern int fd_open(concptr file, int flags); +extern errr fd_lock(int fd, int what); +extern errr fd_seek(int fd, huge n); +extern errr fd_chop(int fd, huge n); +extern errr fd_read(int fd, char *buf, huge n); +extern errr fd_write(int fd, concptr buf, huge n); +extern errr fd_close(int fd); +extern void flush(void); +extern void bell(void); +extern errr play_music(int type, int num); +extern void select_floor_music(void); +extern void sound(int num); +extern void move_cursor(int row, int col); +extern void text_to_ascii(char *buf, concptr str); +extern void ascii_to_text(char *buf, concptr str); +extern errr macro_add(concptr pat, concptr act); +extern sint macro_find_exact(concptr pat); +extern char inkey(void); +extern concptr quark_str(STR_OFFSET num); +extern void quark_init(void); +extern u16b quark_add(concptr str); +extern s32b message_num(void); +extern concptr message_str(int age); +extern void message_add(concptr msg); +extern void msg_erase(void); +extern void msg_print(concptr msg); +extern void msg_print_wizard(int cheat_type, concptr msg); +#ifndef SWIG +extern void msg_format(concptr fmt, ...); +extern void msg_format_wizard(int cheat_type, concptr fmt, ...); +#endif /* SWIG */ +extern void screen_save(void); +extern void screen_load(void); +extern void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col); +extern void put_str(concptr str, TERM_LEN row, TERM_LEN col); +extern void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col); +extern void prt(concptr str, TERM_LEN row, TERM_LEN col); +extern void c_roff(TERM_COLOR attr, concptr str); +extern void roff(concptr str); +extern void clear_from(int row); +extern bool askfor_aux(char *buf, int len, bool numpad_cursor); +extern bool askfor(char *buf, int len); +extern bool get_string(concptr prompt, char *buf, int len); +extern bool get_check(concptr prompt); +extern bool get_check_strict(concptr prompt, BIT_FLAGS mode); +extern bool get_com(concptr prompt, char *command, bool z_escape); +extern QUANTITY get_quantity(concptr prompt, QUANTITY max); +extern void pause_line(int row); +extern void request_command(int shopping); +extern bool is_a_vowel(int ch); +extern int get_keymap_dir(char ch); +extern errr type_string(concptr str, uint len); +extern void roff_to_buf(concptr str, int wlen, char *tbuf, size_t bufsize); + +#ifdef SORT_R_INFO +extern void tag_sort(tag_type elements[], int number); +#endif /* SORT_R_INFO */ + +#ifdef SUPPORT_GAMMA +extern byte gamma_table[256]; +extern void build_gamma_table(int gamma); +#endif /* SUPPORT_GAMMA */ + +extern size_t my_strcpy(char *buf, concptr src, size_t bufsize); +extern size_t my_strcat(char *buf, concptr src, size_t bufsize); +extern char *my_strstr(concptr haystack, concptr needle); +extern char *my_strchr(concptr ptr, char ch); +extern void str_tolower(char *str); +extern int inkey_special(bool numpad_cursor); diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index e4096bec5..8dccb36e3 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "files.h" #include "world.h" #include "quest.h" diff --git a/src/warning.c b/src/warning.c index 85cdb901d..f6cfa12eb 100644 --- a/src/warning.c +++ b/src/warning.c @@ -1,6 +1,8 @@  #include "angband.h" +#include "util.h" + #include "artifact.h" #include "player-move.h" #include "feature.h" diff --git a/src/wild.c b/src/wild.c index 09a5ea3e7..d92a81cf7 100644 --- a/src/wild.c +++ b/src/wild.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "floor.h" #include "wild.h" #include "world.h" diff --git a/src/wizard1.c b/src/wizard1.c index b9a78db7c..400fc3373 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -11,6 +11,8 @@ */ #include "angband.h" +#include "util.h" + #include "sort.h" #include "store.h" #include "monster.h" diff --git a/src/wizard2.c b/src/wizard2.c index 117763d60..a01b21690 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -11,6 +11,7 @@ */ #include "angband.h" +#include "util.h" #include "birth.h" #include "selfinfo.h" #include "patron.h" diff --git a/src/xtra2.c b/src/xtra2.c index 04bbc6d66..ab40660d9 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -12,6 +12,8 @@ #include "angband.h" +#include "util.h" + #include "cmd-pet.h" #include "dungeon-file.h" #include "object-curse.h" -- 2.11.0