From 6de93ffa253ce21d7c0986c04687c32ee82850ec Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 12 Jul 2020 12:50:13 +0900 Subject: [PATCH] [Refactor] #40535 Moved do_cmd_bash() from cmd-basic.c/h --- src/cmd-action/cmd-open-close.c | 57 +++++++++++++++++++++++++++++++++++++++++ src/cmd-action/cmd-open-close.h | 1 + src/cmd/cmd-basic.c | 57 ----------------------------------------- src/cmd/cmd-basic.h | 1 - 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/cmd-action/cmd-open-close.c b/src/cmd-action/cmd-open-close.c index ec40431fc..5ed136c32 100644 --- a/src/cmd-action/cmd-open-close.c +++ b/src/cmd-action/cmd-open-close.c @@ -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 + *
+ * 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.
+ * 
+ */ +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); +} diff --git a/src/cmd-action/cmd-open-close.h b/src/cmd-action/cmd-open-close.h index 7bace2ce9..6cbd34298 100644 --- a/src/cmd-action/cmd-open-close.h +++ b/src/cmd-action/cmd-open-close.h @@ -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); diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index b8ffbf2e7..ec00d80e6 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -120,63 +120,6 @@ void do_cmd_search(player_type *creature_ptr) } /*! - * @brief 「打ち破る」動作コマンドのメインルーチン / - * Bash open a door, success based on character strength - * @return なし - * @details - *
- * 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.
- * 
- */ -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 diff --git a/src/cmd/cmd-basic.h b/src/cmd/cmd-basic.h index 51c626496..c514a4302 100644 --- a/src/cmd/cmd-basic.h +++ b/src/cmd/cmd-basic.h @@ -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); -- 2.11.0