From: Hourier <66951241+Hourier@users.noreply.github.com> Date: Sat, 1 Jul 2023 02:17:01 +0000 (+0900) Subject: [Refactor] #3484 get_aim_dir() のinput_command() シグネチャを変える準備 X-Git-Tag: 3.0.0.87-Alpha~19^2~2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=12c3eb11a06336569448d18a0c732831db1993b2;p=hengbandforosx%2Fhengbandosx.git [Refactor] #3484 get_aim_dir() のinput_command() シグネチャを変える準備 --- diff --git a/src/target/target-getter.cpp b/src/target/target-getter.cpp index 107e1debf..f5bf2a2a5 100644 --- a/src/target/target-getter.cpp +++ b/src/target/target-getter.cpp @@ -20,6 +20,7 @@ #include "timed-effect/player-confusion.h" #include "timed-effect/timed-effects.h" #include "view/display-messages.h" +#include /* * Get an "aiming direction" from the user. @@ -32,31 +33,31 @@ * * Note that confusion over-rides any (explicit?) user choice. */ -bool get_aim_dir(PlayerType *player_ptr, DIRECTION *dp) +bool get_aim_dir(PlayerType *player_ptr, int *dp) { - DIRECTION dir = command_dir; + auto dir = command_dir; if (use_old_target && target_okay(player_ptr)) { dir = 5; } - COMMAND_CODE code; + short code; if (repeat_pull(&code)) { if (!(code == 5 && !target_okay(player_ptr))) { - dir = (DIRECTION)code; + dir = code; } } - *dp = (DIRECTION)code; - char command; - while (!dir) { - concptr p; + *dp = code; + while (dir == 0) { + std::string prompt; if (!target_okay(player_ptr)) { - p = _("方向 ('*'でターゲット選択, ESCで中断)? ", "Direction ('*' to choose a target, Escape to cancel)? "); + prompt = _("方向 ('*'でターゲット選択, ESCで中断)? ", "Direction ('*' to choose a target, Escape to cancel)? "); } else { - p = _("方向 ('5'でターゲットへ, '*'でターゲット再選択, ESCで中断)? ", "Direction ('5' for target, '*' to re-target, Escape to cancel)? "); + prompt = _("方向 ('5'でターゲットへ, '*'でターゲット再選択, ESCで中断)? ", "Direction ('5' for target, '*' to re-target, Escape to cancel)? "); } - if (!input_command(p, &command, true)) { + char command; + if (!input_command(prompt, &command, true)) { break; } @@ -89,12 +90,12 @@ bool get_aim_dir(PlayerType *player_ptr, DIRECTION *dp) dir = 0; } - if (!dir) { + if (dir == 0) { bell(); } } - if (!dir) { + if (dir == 0) { project_length = 0; return false; } diff --git a/src/target/target-getter.h b/src/target/target-getter.h index 0024ca85b..987b62078 100644 --- a/src/target/target-getter.h +++ b/src/target/target-getter.h @@ -3,6 +3,6 @@ #include "system/angband.h" class PlayerType; -bool get_aim_dir(PlayerType *player_ptr, DIRECTION *dp); +bool get_aim_dir(PlayerType *player_ptr, int *dp); bool get_direction(PlayerType *player_ptr, DIRECTION *dp, bool allow_under, bool with_steed); bool get_rep_dir(PlayerType *player_ptr, DIRECTION *dp, bool under);