From cc8df73624f55a4b65cd1647cbaa59630f79488f Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 8 Mar 2020 20:49:12 +0900 Subject: [PATCH] [Refactor] #40236 Separated diary-subtitle-table.c/h from cmd-dump.c --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 2 + Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 6 ++ src/Makefile.am | 1 + src/cmd/cmd-dump.c | 78 +--------------------- src/cmd/diary-subtitle-table.c | 77 +++++++++++++++++++++ src/cmd/diary-subtitle-table.h | 5 ++ 6 files changed, 94 insertions(+), 75 deletions(-) create mode 100644 src/cmd/diary-subtitle-table.c create mode 100644 src/cmd/diary-subtitle-table.h diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index 01c12e514..63a42f592 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -175,6 +175,7 @@ + @@ -351,6 +352,7 @@ + diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index b1c6efdda..dff2a42cb 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -517,6 +517,9 @@ cmd + + cmd + @@ -1016,6 +1019,9 @@ cmd + + cmd + diff --git a/src/Makefile.am b/src/Makefile.am index 6b694c283..244c879ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -133,6 +133,7 @@ hengband_SOURCES = \ \ cmd/feeling-table.c cmd/feeling-table.h \ cmd/monster-group-table.c cmd/monster-group-table.h \ + cmd/diary-subtitle-table.c cmd/diary-subtitle-table.h \ cmd/cmd-activate.c cmd/cmd-activate.h cmd/cmd-basic.c cmd/cmd-basic.h \ cmd/cmd-dump.c cmd/cmd-dump.h cmd/cmd-eat.c cmd/cmd-eat.h \ cmd/cmd-gameoption.c cmd/cmd-gameoption.h cmd/cmd-help.c cmd/cmd-help.h \ diff --git a/src/cmd/cmd-dump.c b/src/cmd/cmd-dump.c index 9c07ede53..09705eaf7 100644 --- a/src/cmd/cmd-dump.c +++ b/src/cmd/cmd-dump.c @@ -79,6 +79,7 @@ #include "floor-town.h" #include "cmd/feeling-table.h" #include "cmd/monster-group-table.h" +#include "cmd/diary-subtitle-table.h" #include "view-mainwindow.h" // 暫定。後で消す #include "english.h" @@ -297,14 +298,11 @@ concptr get_ordinal_number_suffix(int num) } #endif -#define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0])) /*! - * todo テーブルを分離できないか? - * @brief 日記のタイトル表記と内容出力 / + * @brief 日記のタイトル表記と内容出力 + * @param creature_ptr プレーヤーへの参照ポインタ * @return なし - * @details - * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。 */ static void display_diary(player_type *creature_ptr) { @@ -312,76 +310,6 @@ static void display_diary(player_type *creature_ptr) GAME_TEXT file_name[MAX_NLEN]; char buf[1024]; char tmp[80]; -#ifdef JP - static const char subtitle[][30] = { - "最強の肉体を求めて", - "人生それははかない", - "明日に向かって", - "棚からぼたもち", - "あとの祭り", - "それはいい考えだ", - "何とでも言え", - "兎にも角にも", - "ウソだけど", - "もはやこれまで", - "なんでこうなるの", - "それは無理だ", - "倒すべき敵はゲ○ツ", - "ん~?聞こえんなぁ", - "オレの名を言ってみろ", - "頭が変になっちゃった", - "互換しません", - "せっかくだから", - "まだまだ甘いね", - "むごいむごすぎる", - "こんなもんじゃない", - "だめだこりゃ", - "次いってみよう", - "ちょっとだけよ", - "哀しき冒険者", - "野望の果て", - "無限地獄", - "神に喧嘩を売る者", - "未知の世界へ", - "最高の頭脳を求めて" - }; -#else - static const char subtitle[][51] = { - "Quest of The World's Toughest Body", - "Attack is the best form of defence.", - "Might is right.", - "An unexpected windfall", - "A drowning man will catch at a straw", - "Don't count your chickens before they are hatched.", - "It is no use crying over spilt milk.", - "Seeing is believing.", - "Strike the iron while it is hot.", - "I don't care what follows.", - "To dig a well to put out a house on fire.", - "Tomorrow is another day.", - "Easy come, easy go.", - "The more haste, the less speed.", - "Where there is life, there is hope.", - "There is no royal road to *WINNER*.", - "Danger past, God forgotten.", - "The best thing to do now is to run away.", - "Life is but an empty dream.", - "Dead men tell no tales.", - "A book that remains shut is but a block.", - "Misfortunes never come singly.", - "A little knowledge is a dangerous thing.", - "History repeats itself.", - "*WINNER* was not built in a day.", - "Ignorance is bliss.", - "To lose is to win?", - "No medicine can cure folly.", - "All good things come to an end.", - "M$ Empire strikes back.", - "To see is to believe", - "Time is money.", - "Quest of The World's Greatest Brain" - }; -#endif sprintf(file_name, _("playrecord-%s.txt", "playrec-%s.txt"), savefile_base); path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name); diff --git a/src/cmd/diary-subtitle-table.c b/src/cmd/diary-subtitle-table.c new file mode 100644 index 000000000..e704662bc --- /dev/null +++ b/src/cmd/diary-subtitle-table.c @@ -0,0 +1,77 @@ +/* + * @brief 日記のサブタイトルを表すテキストの配列群 + * @date 2020/03/08 + * @author Hourier + */ + +#include "angband.h" +#include "diary-subtitle-table.h" + +concptr subtitle[MAX_SUBTITLE] = { +#ifdef JP + "最強の肉体を求めて", + "人生それははかない", + "明日に向かって", + "棚からぼたもち", + "あとの祭り", + "それはいい考えだ", + "何とでも言え", + "兎にも角にも", + "ウソだけど", + "もはやこれまで", + "なんでこうなるの", + "それは無理だ", + "倒すべき敵はゲ○ツ", + "ん~?聞こえんなぁ", + "オレの名を言ってみろ", + "頭が変になっちゃった", + "互換しません", + "せっかくだから", + "まだまだ甘いね", + "むごいむごすぎる", + "こんなもんじゃない", + "だめだこりゃ", + "次いってみよう", + "ちょっとだけよ", + "哀しき冒険者", + "野望の果て", + "無限地獄", + "神に喧嘩を売る者", + "未知の世界へ", + "最高の頭脳を求めて" +#else + "Quest of The World's Toughest Body", + "Attack is the best form of defence.", + "Might is right.", + "An unexpected windfall", + "A drowning man will catch at a straw", + "Don't count your chickens before they are hatched.", + "It is no use crying over spilt milk.", + "Seeing is believing.", + "Strike the iron while it is hot.", + "I don't care what follows.", + "To dig a well to put out a house on fire.", + "Tomorrow is another day.", + "Easy come, easy go.", + "The more haste, the less speed.", + "Where there is life, there is hope.", + "There is no royal road to *WINNER*.", + "Danger past, God forgotten.", + "The best thing to do now is to run away.", + "Life is but an empty dream.", + "Dead men tell no tales.", + "A book that remains shut is but a block.", + "Misfortunes never come singly.", + "A little knowledge is a dangerous thing.", + "History repeats itself.", + "*WINNER* was not built in a day.", + "Ignorance is bliss.", + "To lose is to win?", + "No medicine can cure folly.", + "All good things come to an end.", + "M$ Empire strikes back.", + "To see is to believe", + "Time is money.", + "Quest of The World's Greatest Brain" +#endif +}; diff --git a/src/cmd/diary-subtitle-table.h b/src/cmd/diary-subtitle-table.h new file mode 100644 index 000000000..87ad6c707 --- /dev/null +++ b/src/cmd/diary-subtitle-table.h @@ -0,0 +1,5 @@ +#pragma once + +#define MAX_SUBTITLE 30 + +extern concptr subtitle[MAX_SUBTITLE]; -- 2.11.0