OSDN Git Service

[Refactor] #40650 Separated cmd-floor.c/h from cmd-item.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 03:21:21 +0000 (12:21 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 20 Aug 2020 03:35:14 +0000 (12:35 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-io/cmd-floor.c [new file with mode: 0644]
src/cmd-io/cmd-floor.h [new file with mode: 0644]
src/cmd-item/cmd-item.c
src/cmd-item/cmd-item.h
src/effect/effect-processor.h

index 39324a7..f5d71ff 100644 (file)
     <ClCompile Include="..\..\src\cmd-action\cmd-tunnel.c" />\r
     <ClCompile Include="..\..\src\action\movement-execution.c" />\r
     <ClCompile Include="..\..\src\cmd-building\cmd-store.c" />\r
+    <ClCompile Include="..\..\src\cmd-io\cmd-floor.c" />\r
     <ClCompile Include="..\..\src\cmd-io\cmd-lore.c" />\r
     <ClCompile Include="..\..\src\cmd-io\cmd-menu-content-table.c" />\r
     <ClCompile Include="..\..\src\cmd-io\macro-util.c" />\r
     <ClInclude Include="..\..\src\cmd-action\cmd-tunnel.h" />\r
     <ClInclude Include="..\..\src\action\movement-execution.h" />\r
     <ClInclude Include="..\..\src\cmd-building\cmd-store.h" />\r
+    <ClInclude Include="..\..\src\cmd-io\cmd-floor.h" />\r
     <ClInclude Include="..\..\src\cmd-io\cmd-lore.h" />\r
     <ClInclude Include="..\..\src\cmd-io\cmd-menu-content-table.h" />\r
     <ClInclude Include="..\..\src\cmd-io\macro-util.h" />\r
index 33c9cc4..115e46d 100644 (file)
     <ClCompile Include="..\..\src\effect\effect-processor.c">
       <Filter>effect</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cmd-io\cmd-floor.c">
+      <Filter>cmd-io</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\effect\effect-processor.h">
       <Filter>effect</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\cmd-io\cmd-floor.h">
+      <Filter>cmd-io</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 967bc3f..6309e63 100644 (file)
@@ -110,6 +110,7 @@ hengband_SOURCES = \
        cmd-io/cmd-autopick.c cmd-io/cmd-autopick.h \
        cmd-io/cmd-diary.c cmd-io/cmd-diary.h \
        cmd-io/cmd-dump.c cmd-io/cmd-dump.h \
+       cmd-io/cmd-floor.c cmd-io/cmd-floor.h \
        cmd-io/cmd-gameoption.c cmd-io/cmd-gameoption.h \
        cmd-io/cmd-help.c cmd-io/cmd-help.h \
        cmd-io/cmd-knowledge.c cmd-io/cmd-knowledge.h \
diff --git a/src/cmd-io/cmd-floor.c b/src/cmd-io/cmd-floor.c
new file mode 100644 (file)
index 0000000..987eb0d
--- /dev/null
@@ -0,0 +1,97 @@
+#include "cmd-io/cmd-floor.h"
+#include "core/asking-player.h"
+#include "core/player-redraw-types.h"
+#include "core/player-update-types.h"
+#include "core/stuff-handler.h"
+#include "core/window-redrawer.h"
+#include "floor/geometry.h"
+#include "game-option/keymap-directory-getter.h"
+#include "io/cursor.h"
+#include "io/screen-util.h"
+#include "main/sound-of-music.h"
+#include "target/target-checker.h"
+#include "target/target-setter.h"
+#include "target/target-types.h"
+#include "view/display-messages.h"
+#include "window/main-window-util.h"
+
+/*!
+ * @brief \83^\81[\83Q\83b\83g\82ð\90Ý\92è\82·\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Target command
+ * @return \82È\82µ
+ */
+void do_cmd_target(player_type *creature_ptr)
+{
+    if (creature_ptr->wild_mode)
+        return;
+
+    if (target_set(creature_ptr, TARGET_KILL))
+        msg_print(_("\83^\81[\83Q\83b\83g\8c\88\92è\81B", "Target Selected."));
+    else
+        msg_print(_("\83^\81[\83Q\83b\83g\89ð\8f\9c\81B", "Target Aborted."));
+}
+
+/*!
+ * @brief \8eü\88Í\82ð\8c©\93n\82·\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Look command
+ * @return \82È\82µ
+ */
+void do_cmd_look(player_type *creature_ptr)
+{
+    creature_ptr->window |= PW_MONSTER_LIST;
+    handle_stuff(creature_ptr);
+    if (target_set(creature_ptr, TARGET_LOOK))
+        msg_print(_("\83^\81[\83Q\83b\83g\8c\88\92è\81B", "Target Selected."));
+}
+
+/*!
+ * @brief \88Ê\92u\82ð\8am\94F\82·\82é\83R\83}\83\93\83h\82Ì\83\81\83C\83\93\83\8b\81[\83`\83\93
+ * Allow the player to examine other sectors on the map
+ * @return \82È\82µ
+ */
+void do_cmd_locate(player_type *creature_ptr)
+{
+    DIRECTION dir;
+    POSITION y1, x1;
+    GAME_TEXT tmp_val[80];
+    GAME_TEXT out_val[160];
+    TERM_LEN wid, hgt;
+    get_screen_size(&wid, &hgt);
+    POSITION y2 = y1 = panel_row_min;
+    POSITION x2 = x1 = panel_col_min;
+    while (TRUE) {
+        if ((y2 == y1) && (x2 == x1))
+            strcpy(tmp_val, _("\90^\8fã", "\0"));
+        else
+            sprintf(tmp_val, "%s%s", ((y2 < y1) ? _("\96k", " North") : (y2 > y1) ? _("\93ì", " South") : ""),
+                ((x2 < x1) ? _("\90¼", " West") : (x2 > x1) ? _("\93\8c", " East") : ""));
+
+        sprintf(out_val, _("\83}\83b\83v\88Ê\92u [%d(%02d),%d(%02d)] (\83v\83\8c\83C\83\84\81[\82Ì%s)  \95û\8cü?", "Map sector [%d(%02d),%d(%02d)], which is%s your sector.  Direction?"),
+            y2 / (hgt / 2), y2 % (hgt / 2), x2 / (wid / 2), x2 % (wid / 2), tmp_val);
+
+        dir = 0;
+        while (!dir) {
+            char command;
+            if (!get_com(out_val, &command, TRUE))
+                break;
+
+            dir = get_keymap_dir(command);
+            if (!dir)
+                bell();
+        }
+
+        if (!dir)
+            break;
+
+        if (change_panel(creature_ptr, ddy[dir], ddx[dir])) {
+            y2 = panel_row_min;
+            x2 = panel_col_min;
+        }
+    }
+
+    verify_panel(creature_ptr);
+    creature_ptr->update |= PU_MONSTERS;
+    creature_ptr->redraw |= PR_MAP;
+    creature_ptr->window |= PW_OVERHEAD | PW_DUNGEON;
+    handle_stuff(creature_ptr);
+}
diff --git a/src/cmd-io/cmd-floor.h b/src/cmd-io/cmd-floor.h
new file mode 100644 (file)
index 0000000..c48b11a
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "system/angband.h"
+
+void do_cmd_target(player_type *creature_ptr);
+void do_cmd_look(player_type *creature_ptr);
+void do_cmd_locate(player_type *creature_ptr);
index 1f47281..a779a6f 100644 (file)
@@ -774,87 +774,6 @@ void do_cmd_refill(player_type *creature_ptr)
 }
 
 /*!
- * @brief ターゲットを設定するコマンドのメインルーチン
- * Target command
- * @return なし
- */
-void do_cmd_target(player_type *creature_ptr)
-{
-    if (creature_ptr->wild_mode)
-        return;
-
-    if (target_set(creature_ptr, TARGET_KILL))
-        msg_print(_("ターゲット決定。", "Target Selected."));
-    else
-        msg_print(_("ターゲット解除。", "Target Aborted."));
-}
-
-/*!
- * @brief 周囲を見渡すコマンドのメインルーチン
- * Look command
- * @return なし
- */
-void do_cmd_look(player_type *creature_ptr)
-{
-    creature_ptr->window |= PW_MONSTER_LIST;
-    handle_stuff(creature_ptr);
-    if (target_set(creature_ptr, TARGET_LOOK))
-        msg_print(_("ターゲット決定。", "Target Selected."));
-}
-
-/*!
- * @brief 位置を確認するコマンドのメインルーチン
- * Allow the player to examine other sectors on the map
- * @return なし
- */
-void do_cmd_locate(player_type *creature_ptr)
-{
-    DIRECTION dir;
-    POSITION y1, x1;
-    GAME_TEXT tmp_val[80];
-    GAME_TEXT out_val[160];
-    TERM_LEN wid, hgt;
-    get_screen_size(&wid, &hgt);
-    POSITION y2 = y1 = panel_row_min;
-    POSITION x2 = x1 = panel_col_min;
-    while (TRUE) {
-        if ((y2 == y1) && (x2 == x1))
-            strcpy(tmp_val, _("真上", "\0"));
-        else
-            sprintf(tmp_val, "%s%s", ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
-                ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
-
-        sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s)  方向?", "Map sector [%d(%02d),%d(%02d)], which is%s your sector.  Direction?"),
-            y2 / (hgt / 2), y2 % (hgt / 2), x2 / (wid / 2), x2 % (wid / 2), tmp_val);
-
-        dir = 0;
-        while (!dir) {
-            char command;
-            if (!get_com(out_val, &command, TRUE))
-                break;
-
-            dir = get_keymap_dir(command);
-            if (!dir)
-                bell();
-        }
-
-        if (!dir)
-            break;
-
-        if (change_panel(creature_ptr, ddy[dir], ddx[dir])) {
-            y2 = panel_row_min;
-            x2 = panel_col_min;
-        }
-    }
-
-    verify_panel(creature_ptr);
-    creature_ptr->update |= (PU_MONSTERS);
-    creature_ptr->redraw |= (PR_MAP);
-    creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-    handle_stuff(creature_ptr);
-}
-
-/*!
  * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
  * Use an item
  * @return なし
index da50ba0..7afcfab 100644 (file)
@@ -12,8 +12,5 @@ void do_cmd_observe(player_type *creature_ptr);
 void do_cmd_uninscribe(player_type *creature_ptr);
 void do_cmd_inscribe(player_type *creature_ptr);
 void do_cmd_refill(player_type *creature_ptr);
-void do_cmd_target(player_type *creature_ptr);
-void do_cmd_look(player_type *creature_ptr);
-void do_cmd_locate(player_type *creature_ptr);
 void do_cmd_use(player_type *creature_ptr);
 void do_cmd_activate(player_type *user_ptr);
index 589efba..ab2a951 100644 (file)
@@ -3,4 +3,4 @@
 #include "system/angband.h"
 
 bool project(player_type *caster_ptr, const MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, const HIT_POINT dam, const EFFECT_ID typ, BIT_FLAGS flag,
-    const int monspell)
+    const int monspell);