From ae4fb8877fb1c5748921e92265fa12eb23701e1a Mon Sep 17 00:00:00 2001 From: deskull Date: Wed, 17 Apr 2019 22:35:02 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20flavor.c=20=E3=82=92=20obj?= =?utf8?q?ect-flavor.c/h=20=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=A6?= =?utf8?q?=20#pragma=20once=20=E3=82=92=E4=BB=96=E3=83=95=E3=82=A1?= =?utf8?q?=E3=82=A4=E3=83=AB=E3=81=AB=E9=81=A9=E7=94=A8=E3=80=82(LNK4042?= =?utf8?q?=E3=81=AE=E7=99=BA=E7=94=9F=E3=81=AF=E6=9A=AB=E5=AE=9A=E7=9A=84?= =?utf8?q?=E3=81=AB=E7=B9=94=E3=82=8A=E8=BE=BC=E3=81=BF=E6=B8=88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 3 ++- Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 7 +++++- src/Makefile.am | 3 ++- src/artifact.c | 1 + src/autopick.c | 1 + src/bldg.c | 1 + src/cmd-eat.c | 1 + src/cmd-item.c | 1 + src/cmd-read.c | 1 + src/cmd-smith.c | 1 + src/cmd2.c | 1 + src/cmd4.c | 1 + src/defines.h | 18 +++----------- src/dungeon.c | 1 + src/externs.h | 9 ------- src/files.c | 1 + src/floor-streams.c | 1 + src/grid.c | 1 + src/h-type.h | 4 +++- src/melee1.c | 1 + src/monster-process.c | 1 + src/monster2.c | 1 + src/object-curse.c | 1 + src/{flavor.c => object-flavor.c} | 3 ++- src/object-flavor.h | 28 ++++++++++++++++++++++ src/object1.c | 1 + src/object2.c | 1 + src/patron.c | 1 + src/player-damage.c | 1 + src/player-move.c | 1 + src/realm-hex.c | 1 + src/rumor.c | 1 + src/shoot.c | 1 + src/spells-object.c | 1 + src/spells-status.c | 1 + src/spells1.c | 1 + src/spells2.c | 1 + src/spells3.c | 1 + src/store.c | 1 + src/types.h | 6 ++++- src/warning.c | 1 + src/wizard1.c | 1 + src/wizard2.c | 1 + src/xtra2.c | 1 + 44 files changed, 86 insertions(+), 30 deletions(-) rename src/{flavor.c => object-flavor.c} (99%) create mode 100644 src/object-flavor.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index 1edee8a2d..ebeb53b80 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -160,6 +160,8 @@ + + @@ -202,7 +204,6 @@ - diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 253a5fb09..28adf949f 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -17,7 +17,6 @@ - @@ -253,6 +252,12 @@ cmd + + object + + + object + diff --git a/src/Makefile.am b/src/Makefile.am index 56bc7ce8e..7c8a2bdb4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ hengband_SOURCES = \ cmd-usestaff.c cmd-usestaff.h cmd-zaprod.c cmd-zaprod.h cmd-zapwand.c \ cmd-zapwand.h cmd-smith.c cmd-smith.h cmd-hissatsu.c cmd-hissatsu.h\ \ - defines.h dungeon.c effects.c externs.h files.c flavor.c \ + defines.h dungeon.c effects.c externs.h files.c \ \ floor.h floor-events.c floor-events.h floor-generate.c floor-generate.h \ floor-save.h floor-save.c \ @@ -46,6 +46,7 @@ hengband_SOURCES = \ object-curse.c object-curse.h object-broken.c object-broken.h \ object-hook.c object-hook.h object1.c object2.c \ objectkind-hook.c objectkind-hook.h \ + object-flavor.c object-flavor.h \ \ patron.h patron.c \ \ diff --git a/src/artifact.c b/src/artifact.c index e3ee6c75a..3aadb5a84 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -17,6 +17,7 @@ #include "cmd-activate.h" #include "object-boost.h" #include "object-curse.h" +#include "object-flavor.h" #include "object-hook.h" #include "spells-object.h" diff --git a/src/autopick.c b/src/autopick.c index 3ad5cea14..08e58c900 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -15,6 +15,7 @@ #include "store.h" #include "player-status.h" #include "player-move.h" +#include "object-flavor.h" #include "object-hook.h" #define MAX_LINELEN 1024 diff --git a/src/bldg.c b/src/bldg.c index 64904f367..694179947 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -15,6 +15,7 @@ #include "angband.h" #include "floor.h" #include "object-boost.h" +#include "object-flavor.h" #include "object-hook.h" #include "monster.h" #include "monsterrace-hook.h" diff --git a/src/cmd-eat.c b/src/cmd-eat.c index 9a0b7a492..e4383fbaa 100644 --- a/src/cmd-eat.c +++ b/src/cmd-eat.c @@ -8,6 +8,7 @@ #include "angband.h" +#include "object-flavor.h" #include "object-hook.h" #include "avatar.h" #include "spells-status.h" diff --git a/src/cmd-item.c b/src/cmd-item.c index 84b963fcb..01b9c5cd9 100644 --- a/src/cmd-item.c +++ b/src/cmd-item.c @@ -22,6 +22,7 @@ #include "cmd-zapwand.h" #include "cmd-pet.h" +#include "object-flavor.h" #include "object-hook.h" #include "sort.h" #include "quest.h" diff --git a/src/cmd-read.c b/src/cmd-read.c index b335dfab5..4d21602f8 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "object-flavor.h" #include "object-hook.h" #include "artifact.h" #include "avatar.h" diff --git a/src/cmd-smith.c b/src/cmd-smith.c index 873a9b116..78da7b579 100644 --- a/src/cmd-smith.c +++ b/src/cmd-smith.c @@ -1,4 +1,5 @@ #include "angband.h" +#include "object-flavor.h" #include "object-hook.h" #include "player-status.h" diff --git a/src/cmd2.c b/src/cmd2.c index 37e966e5c..4c1a16bbc 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -30,6 +30,7 @@ #include "feature.h" #include "player-move.h" #include "object-broken.h" +#include "object-flavor.h" /*! * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理 diff --git a/src/cmd4.c b/src/cmd4.c index 4f6ac1b55..933d336c2 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -49,6 +49,7 @@ #include "store.h" #include "artifact.h" #include "avatar.h" +#include "object-flavor.h" #include "object-hook.h" #include "monster.h" #include "monster-status.h" diff --git a/src/defines.h b/src/defines.h index 5e414f152..0c6da8122 100644 --- a/src/defines.h +++ b/src/defines.h @@ -1,4 +1,6 @@ -/*! +#pragma once + +/*! * @file defines.h * @brief 主要なマクロ定義ヘッダ / Purpose: global constants and macro definitions * @date 2014/01/02 @@ -1860,20 +1862,6 @@ #define PW_BORG_1 0x00004000L /*!<サブウィンドウ描画フラグ: ボーグメッセージ / Display borg messages */ #define PW_BORG_2 0x00008000L /*!<サブウィンドウ描画フラグ: ボーグステータス / Display borg status */ - -/* - * Bit flags for object_desc() - */ -#define OD_NAME_ONLY 0x00000001 /* Omit values, pval, inscription */ -#define OD_NAME_AND_ENCHANT 0x00000002 /* Omit pval, inscription */ -#define OD_OMIT_INSCRIPTION 0x00000004 /* Omit inscription */ -#define OD_OMIT_PREFIX 0x00000008 /* Omit numeric prefix */ -#define OD_NO_PLURAL 0x00000010 /* Don't use plural */ -#define OD_STORE 0x00000020 /* Assume to be aware and known */ -#define OD_NO_FLAVOR 0x00000040 /* Allow to hidden flavor */ -#define OD_FORCE_FLAVOR 0x00000080 /* Get un-shuffled flavor name */ - - /* Empty hand status */ #define EMPTY_HAND_NONE 0x0000 /* Both hands are used */ #define EMPTY_HAND_LARM 0x0001 /* Left hand is empty */ diff --git a/src/dungeon.c b/src/dungeon.c index 583d7adba..cc2312a5b 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -28,6 +28,7 @@ #include "floor-events.h" #include "grid.h" #include "object-curse.h" +#include "object-flavor.h" #include "store.h" #include "spells.h" #include "spells-summon.h" diff --git a/src/externs.h b/src/externs.h index 0df1dc96c..cf310d642 100644 --- a/src/externs.h +++ b/src/externs.h @@ -591,15 +591,6 @@ extern errr get_rnd_line_jonly(concptr file_name, int entry, char *output, int c extern errr counts_write(int where, u32b count); extern u32b counts_read(int where); -/* flavor.c */ -extern void get_table_name_aux(char *out_string); -extern void get_table_name(char *out_string); -extern void get_table_sindarin_aux(char *out_string); -extern void get_table_sindarin(char *out_string); -extern void flavor_init(void); -extern char *object_desc_kosuu(char *t, object_type *o_ptr); -extern void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode); - /* floors.c */ extern void clear_saved_floor_files(void); extern saved_floor_type *get_sf_ptr(FLOOR_IDX floor_id); diff --git a/src/files.c b/src/files.c index f25e50c89..67fdb59d3 100644 --- a/src/files.c +++ b/src/files.c @@ -27,6 +27,7 @@ #include "patron.h" #include "monster.h" #include "monster-status.h" +#include "object-flavor.h" #include "object-hook.h" #include "realm-hex.h" #include "cmd-pet.h" diff --git a/src/floor-streams.c b/src/floor-streams.c index d35f0d99f..483d16aa8 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -22,6 +22,7 @@ #include "grid.h" #include "monster.h" #include "feature.h" +#include "object-flavor.h" #include "object-hook.h" diff --git a/src/grid.c b/src/grid.c index b558abac8..771b8c821 100644 --- a/src/grid.c +++ b/src/grid.c @@ -20,6 +20,7 @@ #include "angband.h" #include "floor.h" #include "world.h" +#include "object-flavor.h" #include "object-hook.h" #include "generate.h" #include "grid.h" diff --git a/src/h-type.h b/src/h-type.h index cd2aa096d..465e4e8cc 100644 --- a/src/h-type.h +++ b/src/h-type.h @@ -1,4 +1,6 @@ -/*! +#pragma once + +/*! * @file h-type.h * @brief ゲーム中に用いる変数型定義 / Basic "types". * @date 2017/12/03 diff --git a/src/melee1.c b/src/melee1.c index cf4c58769..637365bf2 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -23,6 +23,7 @@ #include "avatar.h" #include "player-status.h" #include "realm-hex.h" +#include "object-flavor.h" #include "object-hook.h" #include "grid.h" #include "player-move.h" diff --git a/src/monster-process.c b/src/monster-process.c index c86b46e0b..f41a4ec3c 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -22,6 +22,7 @@ #include "quest.h" #include "avatar.h" #include "realm-hex.h" +#include "object-flavor.h" #include "object-hook.h" #include "feature.h" #include "grid.h" diff --git a/src/monster2.c b/src/monster2.c index 6fdfb3640..c8bf1fbed 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -13,6 +13,7 @@ #include "angband.h" #include "cmd-pet.h" #include "floor.h" +#include "object-flavor.h" #include "monsterrace-hook.h" #include "monster-status.h" #include "monster.h" diff --git a/src/object-curse.c b/src/object-curse.c index bcb48014c..89fb976ab 100644 --- a/src/object-curse.c +++ b/src/object-curse.c @@ -1,4 +1,5 @@ #include "angband.h" +#include "object-flavor.h" #include "object-hook.h" /*! diff --git a/src/flavor.c b/src/object-flavor.c similarity index 99% rename from src/flavor.c rename to src/object-flavor.c index f7f4f92b3..90a9e7567 100644 --- a/src/flavor.c +++ b/src/object-flavor.c @@ -1,5 +1,5 @@ /*! - * @file flavor.c + * @file object-flavor.c * @brief オブジェクトの記述処理 / Mbject flavor code * @date 2014/01/03 * @author @@ -14,6 +14,7 @@ #include "player-status.h" #include "shoot.h" #include "object-hook.h" +#include "object-flavor.h" #include "trap.h" /*! diff --git a/src/object-flavor.h b/src/object-flavor.h new file mode 100644 index 000000000..4d86a99b9 --- /dev/null +++ b/src/object-flavor.h @@ -0,0 +1,28 @@ +#pragma once + +#include "types.h" +#include "h-type.h" + +/* flavor.c */ +extern void get_table_name_aux(char *out_string); +extern void get_table_name(char *out_string); +extern void get_table_sindarin_aux(char *out_string); +extern void get_table_sindarin(char *out_string); +extern void flavor_init(void); +extern char *object_desc_kosuu(char *t, object_type *o_ptr); +extern void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode); + + +/* + * Bit flags for object_desc() + */ +#define OD_NAME_ONLY 0x00000001 /* Omit values, pval, inscription */ +#define OD_NAME_AND_ENCHANT 0x00000002 /* Omit pval, inscription */ +#define OD_OMIT_INSCRIPTION 0x00000004 /* Omit inscription */ +#define OD_OMIT_PREFIX 0x00000008 /* Omit numeric prefix */ +#define OD_NO_PLURAL 0x00000010 /* Don't use plural */ +#define OD_STORE 0x00000020 /* Assume to be aware and known */ +#define OD_NO_FLAVOR 0x00000040 /* Allow to hidden flavor */ +#define OD_FORCE_FLAVOR 0x00000080 /* Get un-shuffled flavor name */ + + diff --git a/src/object1.c b/src/object1.c index c34ed76a0..ca6d2da4b 100644 --- a/src/object1.c +++ b/src/object1.c @@ -15,6 +15,7 @@ #include "artifact.h" #include "floor.h" #include "cmd-activate.h" +#include "object-flavor.h" #include "object-hook.h" #include "player-move.h" #include "monster.h" diff --git a/src/object2.c b/src/object2.c index 06fecc1e8..9ff742fb1 100644 --- a/src/object2.c +++ b/src/object2.c @@ -15,6 +15,7 @@ #include "floor.h" #include "grid.h" #include "object-boost.h" +#include "object-flavor.h" #include "object-hook.h" #include "object-curse.h" #include "objectkind-hook.h" diff --git a/src/patron.c b/src/patron.c index ac1792395..436499538 100644 --- a/src/patron.c +++ b/src/patron.c @@ -4,6 +4,7 @@ #include "patron.h" #include "cmd-pet.h" #include "object-curse.h" +#include "object-flavor.h" #include "monsterrace-hook.h" #include "objectkind-hook.h" #include "mutation.h" diff --git a/src/player-damage.c b/src/player-damage.c index aa6a1ee8f..77b335386 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -1,6 +1,7 @@ #include "angband.h" #include "player-damage.h" #include "artifact.h" +#include "object-flavor.h" #include "object-hook.h" #include "object-broken.h" #include "player-status.h" diff --git a/src/player-move.c b/src/player-move.c index 135e2bb5b..d8b895357 100644 --- a/src/player-move.c +++ b/src/player-move.c @@ -154,6 +154,7 @@ #include "monster.h" #include "monster-spell.h" #include "object-hook.h" +#include "object-flavor.h" #include "spells.h" diff --git a/src/realm-hex.c b/src/realm-hex.c index ae387a1c0..f85ab5a76 100644 --- a/src/realm-hex.c +++ b/src/realm-hex.c @@ -19,6 +19,7 @@ #include "floor.h" #include "cmd-spell.h" #include "cmd-quaff.h" +#include "object-flavor.h" #include "object-hook.h" #include "object-curse.h" #include "spells-status.h" diff --git a/src/rumor.c b/src/rumor.c index a2f3c7ba8..440713a94 100644 --- a/src/rumor.c +++ b/src/rumor.c @@ -1,4 +1,5 @@ #include "angband.h" +#include "object-flavor.h" /* * Display a rumor and apply its effects diff --git a/src/shoot.c b/src/shoot.c index ab06d4973..8e8a065b1 100644 --- a/src/shoot.c +++ b/src/shoot.c @@ -9,6 +9,7 @@ #include "floor.h" #include "grid.h" #include "spells.h" +#include "object-flavor.h" #include "shoot.h" diff --git a/src/spells-object.c b/src/spells-object.c index 6dfa3cddd..90f07572e 100644 --- a/src/spells-object.c +++ b/src/spells-object.c @@ -5,6 +5,7 @@ #include "spells-object.h" #include "object-boost.h" #include "object-hook.h" +#include "object-flavor.h" #include "player-status.h" #include "avatar.h" diff --git a/src/spells-status.c b/src/spells-status.c index 5e4256f30..33deaa33f 100644 --- a/src/spells-status.c +++ b/src/spells-status.c @@ -1,6 +1,7 @@ #include "angband.h" #include "avatar.h" #include "floor.h" +#include "object-flavor.h" #include "player-status.h" #include "spells-status.h" #include "spells.h" diff --git a/src/spells1.c b/src/spells1.c index ecb3bbcc4..b0543b8b1 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -38,6 +38,7 @@ #include "realm-hex.h" #include "object-hook.h" #include "object-broken.h" +#include "object-flavor.h" #include "quest.h" #include "term.h" #include "grid.h" diff --git a/src/spells2.c b/src/spells2.c index cd49da24a..490016594 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -28,6 +28,7 @@ #include "spells-status.h" #include "spells-floor.h" #include "realm-hex.h" +#include "object-flavor.h" #include "object-hook.h" #include "monster-status.h" #include "player-move.h" diff --git a/src/spells3.c b/src/spells3.c index 39cb537a3..3d51b17c9 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -14,6 +14,7 @@ #include "angband.h" #include "floor.h" #include "object-boost.h" +#include "object-flavor.h" #include "object-hook.h" #include "melee.h" #include "player-move.h" diff --git a/src/store.c b/src/store.c index 16f4bac56..2a727cb3a 100644 --- a/src/store.c +++ b/src/store.c @@ -21,6 +21,7 @@ #include "cmd-spell.h" #include "rumor.h" #include "player-status.h" +#include "object-flavor.h" #include "object-hook.h" #define MIN_STOCK 12 diff --git a/src/types.h b/src/types.h index c030f0220..4e4a906df 100644 --- a/src/types.h +++ b/src/types.h @@ -1,4 +1,6 @@ -/*! +#pragma once + +/*! * @file types.h * @brief グローバルな構造体の定義 / global type declarations * @date 2014/08/10 @@ -43,6 +45,8 @@ * */ +#include "h-type.h" +#include "defines.h" /*! * @struct feature_state diff --git a/src/warning.c b/src/warning.c index fa21864ee..85cdb901d 100644 --- a/src/warning.c +++ b/src/warning.c @@ -10,6 +10,7 @@ #include "monster.h" #include "monster-spell.h" #include "spells.h" +#include "object-flavor.h" /*! * @brief 警告を放つアイテムを選択する / diff --git a/src/wizard1.c b/src/wizard1.c index 346bbdae8..b9a78db7c 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -14,6 +14,7 @@ #include "sort.h" #include "store.h" #include "monster.h" +#include "object-flavor.h" #include "object-hook.h" diff --git a/src/wizard2.c b/src/wizard2.c index 6283736ec..76ad5b2cc 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -25,6 +25,7 @@ #include "spells-world.h" #include "spells-floor.h" +#include "object-flavor.h" #include "object-hook.h" #include "monster-status.h" diff --git a/src/xtra2.c b/src/xtra2.c index 4f0c5fb25..6bc9610b5 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -14,6 +14,7 @@ #include "angband.h" #include "cmd-pet.h" #include "object-curse.h" +#include "object-flavor.h" #include "monster.h" #include "monsterrace-hook.h" #include "objectkind-hook.h" -- 2.11.0