OSDN Git Service

[Refactor] #40236 Separated diary-subtitle-table.c/h from cmd-dump.c
authorHourier <hourier@users.sourceforge.jp>
Sun, 8 Mar 2020 11:49:12 +0000 (20:49 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 8 Mar 2020 11:52:28 +0000 (20:52 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd/cmd-dump.c
src/cmd/diary-subtitle-table.c [new file with mode: 0644]
src/cmd/diary-subtitle-table.h [new file with mode: 0644]

index 01c12e5..63a42f5 100644 (file)
     <ClCompile Include="..\..\src\cmd\cmd-usestaff.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-zaprod.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-zapwand.c" />\r
+    <ClCompile Include="..\..\src\cmd\diary-subtitle-table.c" />\r
     <ClCompile Include="..\..\src\cmd\feeling-table.c" />\r
     <ClCompile Include="..\..\src\cmd\monster-group-table.c" />\r
     <ClCompile Include="..\..\src\combat\melee1.c" />\r
     <ClInclude Include="..\..\src\cmd\cmd-usestaff.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-zaprod.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-zapwand.h" />\r
+    <ClInclude Include="..\..\src\cmd\diary-subtitle-table.h" />\r
     <ClInclude Include="..\..\src\cmd\feeling-table.h" />\r
     <ClInclude Include="..\..\src\cmd\monster-group-table.h" />\r
     <ClInclude Include="..\..\src\combat\melee.h" />\r
index b1c6efd..dff2a42 100644 (file)
     <ClCompile Include="..\..\src\cmd\monster-group-table.c">
       <Filter>cmd</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cmd\diary-subtitle-table.c">
+      <Filter>cmd</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\gamevalue.h" />
     <ClInclude Include="..\..\src\cmd\monster-group-table.h">
       <Filter>cmd</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\cmd\diary-subtitle-table.h">
+      <Filter>cmd</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 6b694c2..244c879 100644 (file)
@@ -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 \
index 9c07ede..09705ea 100644 (file)
@@ -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 (file)
index 0000000..e704662
--- /dev/null
@@ -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 (file)
index 0000000..87ad6c7
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#define MAX_SUBTITLE 30
+
+extern concptr subtitle[MAX_SUBTITLE];