OSDN Git Service

[Refactor] #40535 Moved do_cmd_bash() from cmd-basic.c/h
authorHourier <hourier@users.sourceforge.jp>
Sun, 12 Jul 2020 03:50:13 +0000 (12:50 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 12 Jul 2020 03:50:13 +0000 (12:50 +0900)
src/cmd-action/cmd-open-close.c
src/cmd-action/cmd-open-close.h
src/cmd/cmd-basic.c
src/cmd/cmd-basic.h

index ec40431..5ed136c 100644 (file)
@@ -236,3 +236,60 @@ void do_cmd_disarm(player_type *creature_ptr)
     if (!more)
         disturb(creature_ptr, FALSE, FALSE);
 }
+
+/*!
+ * @brief 「打ち破る」動作コマンドのメインルーチン /
+ * Bash open a door, success based on character strength
+ * @return なし
+ * @details
+ * <pre>
+ * For a closed door, pval is positive if locked; negative if stuck.
+ *
+ * For an open door, pval is positive for a broken door.
+ *
+ * A closed door can be opened - harder if locked. Any door might be
+ * bashed open (and thereby broken). Bashing a door is (potentially)
+ * faster! You move into the door way. To open a stuck door, it must
+ * be bashed. A closed door can be jammed (see do_cmd_spike()).
+ *
+ * Creatures can also open or bash doors, see elsewhere.
+ * </pre>
+ */
+void do_cmd_bash(player_type *creature_ptr)
+{
+    POSITION y, x;
+    DIRECTION dir;
+    grid_type *g_ptr;
+    bool more = FALSE;
+    if (creature_ptr->wild_mode)
+        return;
+
+    if (creature_ptr->special_defense & KATA_MUSOU)
+        set_action(creature_ptr, ACTION_NONE);
+
+    if (command_arg) {
+        command_rep = command_arg - 1;
+        creature_ptr->redraw |= (PR_STATE);
+        command_arg = 0;
+    }
+
+    if (get_rep_dir(creature_ptr, &dir, FALSE)) {
+        FEAT_IDX feat;
+        y = creature_ptr->y + ddy[dir];
+        x = creature_ptr->x + ddx[dir];
+        g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
+        feat = get_feat_mimic(g_ptr);
+        if (!have_flag(f_info[feat].flags, FF_BASH)) {
+            msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
+        } else if (g_ptr->m_idx) {
+            take_turn(creature_ptr, 100);
+            msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
+            do_cmd_attack(creature_ptr, y, x, 0);
+        } else {
+            more = exe_bash(creature_ptr, y, x, dir);
+        }
+    }
+
+    if (!more)
+        disturb(creature_ptr, FALSE, FALSE);
+}
index 7bace2c..6cbd342 100644 (file)
@@ -5,3 +5,4 @@
 void do_cmd_open(player_type *creature_ptr);
 void do_cmd_close(player_type *creature_ptr);
 void do_cmd_disarm(player_type *creature_ptr);
+void do_cmd_bash(player_type *creature_ptr);
index b8ffbf2..ec00d80 100644 (file)
@@ -120,63 +120,6 @@ void do_cmd_search(player_type *creature_ptr)
 }
 
 /*!
- * @brief 「打ち破る」動作コマンドのメインルーチン /
- * Bash open a door, success based on character strength
- * @return なし
- * @details
- * <pre>
- * For a closed door, pval is positive if locked; negative if stuck.
- *
- * For an open door, pval is positive for a broken door.
- *
- * A closed door can be opened - harder if locked. Any door might be
- * bashed open (and thereby broken). Bashing a door is (potentially)
- * faster! You move into the door way. To open a stuck door, it must
- * be bashed. A closed door can be jammed (see do_cmd_spike()).
- *
- * Creatures can also open or bash doors, see elsewhere.
- * </pre>
- */
-void do_cmd_bash(player_type *creature_ptr)
-{
-    POSITION y, x;
-    DIRECTION dir;
-    grid_type *g_ptr;
-    bool more = FALSE;
-    if (creature_ptr->wild_mode)
-        return;
-
-    if (creature_ptr->special_defense & KATA_MUSOU)
-        set_action(creature_ptr, ACTION_NONE);
-
-    if (command_arg) {
-        command_rep = command_arg - 1;
-        creature_ptr->redraw |= (PR_STATE);
-        command_arg = 0;
-    }
-
-    if (get_rep_dir(creature_ptr, &dir, FALSE)) {
-        FEAT_IDX feat;
-        y = creature_ptr->y + ddy[dir];
-        x = creature_ptr->x + ddx[dir];
-        g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
-        feat = get_feat_mimic(g_ptr);
-        if (!have_flag(f_info[feat].flags, FF_BASH)) {
-            msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
-        } else if (g_ptr->m_idx) {
-            take_turn(creature_ptr, 100);
-            msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
-            do_cmd_attack(creature_ptr, y, x, 0);
-        } else {
-            more = exe_bash(creature_ptr, y, x, dir);
-        }
-    }
-
-    if (!more)
-        disturb(creature_ptr, FALSE, FALSE);
-}
-
-/*!
  * @brief 特定のマスに影響を及ぼすための汎用的コマンド
  * @return なし
  * @details
index 51c6264..c514a43 100644 (file)
@@ -4,7 +4,6 @@
 
 void forget_travel_flow(floor_type *floor_ptr);
 void do_cmd_search(player_type *creature_ptr);
-void do_cmd_bash(player_type *creature_ptr);
 void do_cmd_alter(player_type *creature_ptr);
 void do_cmd_spike(player_type *creature_ptr);
 void do_cmd_walk(player_type *creature_ptr, bool pickup);