OSDN Git Service

[Refactor] #40275 Separated cmd-inn.c/h from bldg.c
authorHourier <hourier@users.sourceforge.jp>
Tue, 21 Apr 2020 13:17:36 +0000 (22:17 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 21 Apr 2020 13:17:36 +0000 (22:17 +0900)
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/bldg.c
src/cmd/cmd-inn.c [new file with mode: 0644]
src/cmd/cmd-inn.h [new file with mode: 0644]

index db8fce6..c7648e9 100644 (file)
     <ClCompile Include="..\..\src\cmd\cmd-gameoption.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-help.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-hissatsu.c" />\r
+    <ClCompile Include="..\..\src\cmd\cmd-inn.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-inventory.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-item.c" />\r
     <ClCompile Include="..\..\src\cmd\cmd-macro.c" />\r
     <ClInclude Include="..\..\src\cmd\cmd-gameoption.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-help.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-hissatsu.h" />\r
+    <ClInclude Include="..\..\src\cmd\cmd-inn.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-inventory.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-item.h" />\r
     <ClInclude Include="..\..\src\cmd\cmd-macro.h" />\r
index 240db49..3e9d2b1 100644 (file)
     <ClCompile Include="..\..\src\player\mimic-info-table.c">
       <Filter>player</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cmd\cmd-inn.c">
+      <Filter>cmd</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\gamevalue.h" />
     <ClInclude Include="..\..\src\player\mimic-info-table.h">
       <Filter>player</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\cmd\cmd-inn.h">
+      <Filter>cmd</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 9cce490..f89b678 100644 (file)
@@ -152,7 +152,7 @@ hengband_SOURCES = \
        cmd/cmd-diary.c cmd/cmd-diary.h cmd/cmd-dump.c cmd/cmd-dump.h \
        cmd/cmd-draw.c cmd/cmd-draw.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 \
-       cmd/cmd-hissatsu.c cmd/cmd-hissatsu.h \
+       cmd/cmd-hissatsu.c cmd/cmd-hissatsu.h cmd/cmd-inn.c cmd/cmd-inn.h \
        cmd/cmd-inventory.c cmd/cmd-inventory.h cmd/cmd-item.c cmd/cmd-item.h \
        cmd/lighting-level-table.c cmd/lighting-level-table.h \
        cmd/cmd-magiceat.c cmd/cmd-magiceat.h cmd/cmd-mane.c cmd/cmd-mane.h \
index 8c0e137..87305ba 100644 (file)
@@ -18,9 +18,8 @@
 
 #include "core.h"
 #include "core/show-file.h"
-#include "io/write-diary.h"
 #include "cmd/cmd-dump.h"
-#include "cmd/cmd-magiceat.h"
+#include "cmd/cmd-inn.h"
 #include "floor.h"
 #include "floor-events.h"
 #include "floor-save.h"
@@ -43,7 +42,6 @@
 #include "quest.h"
 #include "artifact.h"
 #include "cmd-spell.h"
-#include "rumor.h"
 #include "spells.h"
 #include "spells-object.h"
 #include "spells-status.h"
@@ -894,130 +892,6 @@ static bool kankin(player_type *player_ptr)
 
 
 /*!
- * @brief 宿屋の利用サブルーチン
- * @details inn commands\n
- * Note that resting for the night was a perfect way to avoid player\n
- * ghosts in the town *if* you could only make it to the inn in time (-:\n
- * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
- * will not be that useful.  I will keep it in the hopes the player\n
- * ghost code does become a reality again. Does help to avoid filthy urchins.\n
- * Resting at night is also a quick way to restock stores -KMW-\n
- * @param cmd 宿屋の利用施設ID
- * @return 施設の利用が実際に行われたか否か。
- */
-static bool inn_comm(player_type *customer_ptr, int cmd)
-{
-       switch (cmd)
-       {
-       case BACT_FOOD: /* Buy food & drink */
-               if (customer_ptr->food >= PY_FOOD_FULL)
-               {
-                       msg_print(_("今は満腹だ。", "You are full now."));
-                       return FALSE;
-               }
-
-               msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
-               (void)set_food(customer_ptr, PY_FOOD_MAX - 1);
-               break;
-
-       case BACT_REST: /* Rest for the night */
-       {
-               if ((customer_ptr->poisoned) || (customer_ptr->cut))
-               {
-                       msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
-                       msg_print(NULL);
-                       msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
-                       break;
-               }
-
-               s32b oldturn = current_world_ptr->game_turn;
-               int prev_day, prev_hour, prev_min;
-
-               extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min);
-               bool is_player_undead = PRACE_IS_(customer_ptr, RACE_SKELETON) ||
-                       PRACE_IS_(customer_ptr, RACE_ZOMBIE) ||
-                       PRACE_IS_(customer_ptr, RACE_VAMPIRE) ||
-                       PRACE_IS_(customer_ptr, RACE_SPECTRE);
-               if ((prev_hour >= 6) && (prev_hour < 18))
-               {
-                       concptr stay_message_jp = is_player_undead ? "宿屋に泊まった" : "日が暮れるまで宿屋で過ごした";
-                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _(stay_message_jp, "stayed during the day at the inn."));
-               }
-               else
-               {
-                       concptr stay_message_jp = is_player_undead ? "夜が明けるまで宿屋で過ごした" : "宿屋に泊まった";
-                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _(stay_message_jp, "stayed overnight at the inn."));
-               }
-
-               current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
-               if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
-               {
-                       current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
-                       if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
-               }
-
-               prevent_turn_overflow(customer_ptr);
-
-               if ((prev_hour >= 18) && (prev_hour <= 23)) exe_write_diary(customer_ptr, DIARY_DIALY, 0, NULL);
-               customer_ptr->chp = customer_ptr->mhp;
-
-               if (ironman_nightmare)
-               {
-                       msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
-
-                       while (TRUE)
-                       {
-                               sanity_blast(customer_ptr, NULL, FALSE);
-                               if (!one_in_(3)) break;
-                       }
-
-                       msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
-                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare."));
-                       break;
-               }
-
-               set_blind(customer_ptr, 0);
-               set_confused(customer_ptr, 0);
-               customer_ptr->stun = 0;
-               customer_ptr->chp = customer_ptr->mhp;
-               customer_ptr->csp = customer_ptr->msp;
-               if (customer_ptr->pclass == CLASS_MAGIC_EATER)
-               {
-                       int i;
-                       for (i = 0; i < 72; i++)
-                       {
-                               customer_ptr->magic_num1[i] = customer_ptr->magic_num2[i] * EATER_CHARGE;
-                       }
-
-                       for (; i < 108; i++)
-                       {
-                               customer_ptr->magic_num1[i] = 0;
-                       }
-               }
-
-               if ((prev_hour >= 6) && (prev_hour <= 17))
-               {
-                       msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
-                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("夕方を迎えた。", "awoke refreshed."));
-                       break;
-               }
-
-               msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
-               exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("すがすがしい朝を迎えた。", "awoke refreshed."));
-               break;
-       }
-       case BACT_RUMORS: /* Listen for rumors */
-       {
-               display_rumor(customer_ptr, TRUE);
-               break;
-       }
-       }
-
-       return TRUE;
-}
-
-
-/*!
  * @brief クエスト情報を表示しつつ処理する。/ Display quest information
  * @param player_ptr プレーヤーへの参照ポインタ
  * @param questnum クエストのID
diff --git a/src/cmd/cmd-inn.c b/src/cmd/cmd-inn.c
new file mode 100644 (file)
index 0000000..96533b7
--- /dev/null
@@ -0,0 +1,131 @@
+#include "angband.h"
+#include "cmd/cmd-inn.h"
+#include "cmd/cmd-magiceat.h"
+#include "io/write-diary.h"
+#include "world.h"
+#include "player-effects.h"
+#include "core.h" // 暫定、後で消す.
+#include "rumor.h"
+
+/*!
+ * @brief 宿屋の利用サブルーチン
+ * @details inn commands\n
+ * Note that resting for the night was a perfect way to avoid player\n
+ * ghosts in the town *if* you could only make it to the inn in time (-:\n
+ * Now that the ghosts are temporarily disabled in 2.8.X, this function\n
+ * will not be that useful.  I will keep it in the hopes the player\n
+ * ghost code does become a reality again. Does help to avoid filthy urchins.\n
+ * Resting at night is also a quick way to restock stores -KMW-\n
+ * @param cmd 宿屋の利用施設ID
+ * @return 施設の利用が実際に行われたか否か。
+ */
+bool inn_comm(player_type *customer_ptr, int cmd)
+{
+       switch (cmd)
+       {
+       case BACT_FOOD: /* Buy food & drink */
+               if (customer_ptr->food >= PY_FOOD_FULL)
+               {
+                       msg_print(_("今は満腹だ。", "You are full now."));
+                       return FALSE;
+               }
+
+               msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
+               (void)set_food(customer_ptr, PY_FOOD_MAX - 1);
+               break;
+
+       case BACT_REST: /* Rest for the night */
+       {
+               if ((customer_ptr->poisoned) || (customer_ptr->cut))
+               {
+                       msg_print(_("あなたに必要なのは部屋ではなく、治療者です。", "You need a healer, not a room."));
+                       msg_print(NULL);
+                       msg_print(_("すみません、でもうちで誰かに死なれちゃ困りますんで。", "Sorry, but don't want anyone dying in here."));
+                       break;
+               }
+
+               s32b oldturn = current_world_ptr->game_turn;
+               int prev_day, prev_hour, prev_min;
+
+               extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min);
+               bool is_player_undead = PRACE_IS_(customer_ptr, RACE_SKELETON) ||
+                       PRACE_IS_(customer_ptr, RACE_ZOMBIE) ||
+                       PRACE_IS_(customer_ptr, RACE_VAMPIRE) ||
+                       PRACE_IS_(customer_ptr, RACE_SPECTRE);
+               if ((prev_hour >= 6) && (prev_hour < 18))
+               {
+                       concptr stay_message_jp = is_player_undead ? "宿屋に泊まった" : "日が暮れるまで宿屋で過ごした";
+                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _(stay_message_jp, "stayed during the day at the inn."));
+               }
+               else
+               {
+                       concptr stay_message_jp = is_player_undead ? "夜が明けるまで宿屋で過ごした" : "宿屋に泊まった";
+                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _(stay_message_jp, "stayed overnight at the inn."));
+               }
+
+               current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
+               if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
+               {
+                       current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
+                       if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
+               }
+
+               prevent_turn_overflow(customer_ptr);
+
+               if ((prev_hour >= 18) && (prev_hour <= 23)) exe_write_diary(customer_ptr, DIARY_DIALY, 0, NULL);
+               customer_ptr->chp = customer_ptr->mhp;
+
+               if (ironman_nightmare)
+               {
+                       msg_print(_("眠りに就くと恐ろしい光景が心をよぎった。", "Horrible visions flit through your mind as you sleep."));
+
+                       while (TRUE)
+                       {
+                               sanity_blast(customer_ptr, NULL, FALSE);
+                               if (!one_in_(3)) break;
+                       }
+
+                       msg_print(_("あなたは絶叫して目を覚ました。", "You awake screaming."));
+                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("悪夢にうなされてよく眠れなかった。", "had a nightmare."));
+                       break;
+               }
+
+               set_blind(customer_ptr, 0);
+               set_confused(customer_ptr, 0);
+               customer_ptr->stun = 0;
+               customer_ptr->chp = customer_ptr->mhp;
+               customer_ptr->csp = customer_ptr->msp;
+               if (customer_ptr->pclass == CLASS_MAGIC_EATER)
+               {
+                       int i;
+                       for (i = 0; i < 72; i++)
+                       {
+                               customer_ptr->magic_num1[i] = customer_ptr->magic_num2[i] * EATER_CHARGE;
+                       }
+
+                       for (; i < 108; i++)
+                       {
+                               customer_ptr->magic_num1[i] = 0;
+                       }
+               }
+
+               if ((prev_hour >= 6) && (prev_hour <= 17))
+               {
+                       msg_print(_("あなたはリフレッシュして目覚め、夕方を迎えた。", "You awake refreshed for the evening."));
+                       exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("夕方を迎えた。", "awoke refreshed."));
+                       break;
+               }
+
+               msg_print(_("あなたはリフレッシュして目覚め、新たな日を迎えた。", "You awake refreshed for the new day."));
+               exe_write_diary(customer_ptr, DIARY_DESCRIPTION, 0, _("すがすがしい朝を迎えた。", "awoke refreshed."));
+               break;
+       }
+       case BACT_RUMORS: /* Listen for rumors */
+       {
+               display_rumor(customer_ptr, TRUE);
+               break;
+       }
+       }
+
+       return TRUE;
+}
diff --git a/src/cmd/cmd-inn.h b/src/cmd/cmd-inn.h
new file mode 100644 (file)
index 0000000..bf756c2
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+bool inn_comm(player_type *customer_ptr, int cmd);