Skip to content

Commit

Permalink
[Refactor] #3499 asking-player.cpp/h に定義された、get_hoge() を全てinput_hoge(…
Browse files Browse the repository at this point in the history
…) に変えた
  • Loading branch information
Hourier authored and sikabane-works committed May 12, 2024
1 parent e35c735 commit 82a7b77
Show file tree
Hide file tree
Showing 69 changed files with 122 additions and 135 deletions.
2 changes: 1 addition & 1 deletion src/action/mutation-execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool exe_mutation_power(PlayerType *player_ptr, PlayerMutationType power)
(void)berserk(player_ptr, randint1(25) + 25);
return true;
case PlayerMutationType::POLYMORPH:
if (!get_check(_("変身します。よろしいですか?", "You will polymorph your self. Are you sure? "))) {
if (!input_check(_("変身します。よろしいですか?", "You will polymorph your self. Are you sure? "))) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/action/racial-execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ racial_level_check_result check_racial_level(PlayerType *player_ptr, rpi_type *r
energy.reset_player_turn();
return RACIAL_CANCEL;
} else if (player_ptr->chp < use_hp) {
if (!get_check(_("本当に今の衰弱した状態でこの能力を使いますか?", "Really use the power in your weakened state? "))) {
if (!input_check(_("本当に今の衰弱した状態でこの能力を使いますか?", "Really use the power in your weakened state? "))) {
energy.reset_player_turn();
return RACIAL_CANCEL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/autopick/autopick-editor-command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ape_quittance do_editor_command(PlayerType *player_ptr, text_body_type *tb, int
switch (com_id) {
case EC_QUIT: {
if (tb->changed) {
if (!get_check(_("全ての変更を破棄してから終了します。よろしいですか? ", "Discard all changes and quit. Are you sure? "))) {
if (!input_check(_("全ての変更を破棄してから終了します。よろしいですか? ", "Discard all changes and quit. Are you sure? "))) {
break;
}
}
Expand All @@ -52,7 +52,7 @@ ape_quittance do_editor_command(PlayerType *player_ptr, text_body_type *tb, int
case EC_SAVEQUIT:
return APE_QUIT_AND_SAVE;
case EC_REVERT: {
if (!get_check(_("全ての変更を破棄して元の状態に戻します。よろしいですか? ", "Discard all changes and revert to original file. Are you sure? "))) {
if (!input_check(_("全ての変更を破棄して元の状態に戻します。よろしいですか? ", "Discard all changes and revert to original file. Are you sure? "))) {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/autopick/autopick-registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static bool clear_auto_register(PlayerType *player_ptr)
msg_format(_("以前のキャラクター用の自動設定(%d行)が残っています。", "Auto registered lines (%d lines) for previous character are remaining."), num);
constexpr auto mes = _("古い設定行は削除します。よろしいですか?", "These lines will be deleted. Are you sure? ");

if (!get_check(mes)) {
if (!input_check(mes)) {
okay = false;
autoregister = false;

Expand Down
2 changes: 1 addition & 1 deletion src/autopick/autopick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void autopick_pickup_items(PlayerType *player_ptr, grid_type *g_ptr)

std::stringstream ss;
ss << _(item_name, "Pick up ") << _("を拾いますか", item_name) << "? ";
if (!get_check(ss.str())) {
if (!input_check(ss.str())) {
o_ptr->marked.set({ OmType::SUPRESS_MESSAGE, OmType::NO_QUERY });
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/birth/birth-select-realm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static bool check_realm_selection(PlayerType *player_ptr, int count)
(void)inkey();
prt("", 0, 0);
return true;
} else if (get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
} else if (input_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/birth/birth-wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static bool let_player_select_race(PlayerType *player_ptr)

clear_from(10);
display_wrap_around(race_explanations[enum2i(player_ptr->prace)], 74, 12, 3);
if (get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
if (input_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
break;
}

Expand All @@ -212,7 +212,7 @@ static bool let_player_select_class(PlayerType *player_ptr)
clear_from(10);
display_wrap_around(class_explanations[enum2i(player_ptr->pclass)], 74, 12, 3);

if (get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
if (input_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
break;
}

Expand All @@ -233,7 +233,7 @@ static bool let_player_select_personality(PlayerType *player_ptr)
clear_from(10);
display_wrap_around(personality_explanations[player_ptr->ppersonality], 74, 12, 3);

if (get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
if (input_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y)) {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/blue-magic/learnt-power-getter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static bool confirm_cast_blue_magic(MonsterAbilityType spell)
{
char tmp_val[160];
(void)strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers.at(spell).name);
return get_check(tmp_val);
return input_check(tmp_val);
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-action/cmd-attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool do_cmd_attack(PlayerType *player_ptr, POSITION y, POSITION x, combat_option
chg_virtue(player_ptr, Virtue::JUSTICE, -1);
chg_virtue(player_ptr, Virtue::COMPASSION, -1);
} else if (!PlayerClass(player_ptr).equals(PlayerClassType::BERSERKER)) {
if (get_check(_("本当に攻撃しますか?", "Really hit it? "))) {
if (input_check(_("本当に攻撃しますか?", "Really hit it? "))) {
chg_virtue(player_ptr, Virtue::INDIVIDUALISM, 1);
chg_virtue(player_ptr, Virtue::HONOUR, -1);
chg_virtue(player_ptr, Virtue::JUSTICE, -1);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-action/cmd-mind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static bool check_mind_hp_mp_sufficiency(PlayerType *player_ptr, cm_type *cm_ptr
return false;
}

return get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "));
return input_check(_("それでも挑戦しますか? ", "Attempt it anyway? "));
}

static void decide_mind_chance(PlayerType *player_ptr, cm_type *cm_ptr)
Expand Down
4 changes: 2 additions & 2 deletions src/cmd-action/cmd-move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static bool confirm_leave_level(PlayerType *player_ptr, bool down_stair)

if (confirm_quest && inside_quest(player_ptr->current_floor_ptr->quest_number) && caution_in_quest) {
msg_print(_("この階を一度去ると二度と戻って来られません。", "You can't come back here once you leave this floor."));
return get_check(_("本当にこの階を去りますか?", "Really leave this floor? "));
return input_check(_("本当にこの階を去りますか?", "Really leave this floor? "));
}

return true;
Expand Down Expand Up @@ -272,7 +272,7 @@ void do_cmd_go_down(PlayerType *player_ptr)
const auto mes = _("ここには%sの入り口(%d階相当)があります", "There is the entrance of %s (Danger level: %d)");
const auto &dungeon = dungeons_info[target_dungeon];
msg_format(mes, dungeon.name.data(), dungeon.mindepth);
if (!get_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) {
if (!input_check(_("本当にこのダンジョンに入りますか?", "Do you really get in this dungeon? "))) {
return;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cmd-action/cmd-others.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void accept_winner_message(PlayerType *player_ptr)
continue;
}

if (!get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY)) {
if (!input_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY)) {
break;
}
}
Expand All @@ -176,11 +176,11 @@ void do_cmd_suicide(PlayerType *player_ptr)
char i;
flush();
if (w_ptr->total_winner) {
if (!get_check_strict(player_ptr, _("虚無りますか? ", "Do you want to go to the Nihil War? "), CHECK_NO_HISTORY)) {
if (!input_check_strict(player_ptr, _("虚無りますか? ", "Do you want to go to the Nihil War? "), CHECK_NO_HISTORY)) {
return;
}
} else {
if (!get_check(_("何もかも諦めますか? ", "Do you give up everything? "))) {
if (!input_check(_("何もかも諦めますか? ", "Do you give up everything? "))) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-action/cmd-racial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static bool ask_invoke_racial_power(rc_type *rc_ptr)

char tmp_val[160];
(void)strnfmt(tmp_val, 78, _("%sを使いますか? ", "Use %s? "), rc_ptr->power_desc[rc_ptr->command_code].racial_name.data());
return get_check(tmp_val);
return input_check(tmp_val);
}

static void racial_power_display_explanation(PlayerType *player_ptr, rc_type *rc_ptr)
Expand Down
8 changes: 4 additions & 4 deletions src/cmd-action/cmd-spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ void do_cmd_study(PlayerType *player_ptr)
if (tval == get_realm2_book(player_ptr)) {
increment = 32;
} else if (tval != get_realm1_book(player_ptr)) {
if (!get_check(_("本当に魔法の領域を変更しますか?", "Really, change magic realm? "))) {
if (!input_check(_("本当に魔法の領域を変更しますか?", "Really, change magic realm? "))) {
return;
}

Expand Down Expand Up @@ -857,9 +857,9 @@ void do_cmd_study(PlayerType *player_ptr)
return;
}
#ifdef JP
if (!get_check(format("%sの%sをさらに学びます。よろしいですか?", spell_name->data(), spell_category.data()))) {
if (!input_check(format("%sの%sをさらに学びます。よろしいですか?", spell_name->data(), spell_category.data()))) {
#else
if (!get_check(format("You will study a %s of %s again. Are you sure? ", spell_category.data(), spell_name->data()))) {
if (!input_check(format("You will study a %s of %s again. Are you sure? ", spell_category.data(), spell_name->data()))) {
#endif
return;
}
Expand Down Expand Up @@ -1078,7 +1078,7 @@ bool do_cmd_cast(PlayerType *player_ptr)
}

/* Verify */
if (!get_check_strict(player_ptr, _("それでも挑戦しますか? ", "Attempt it anyway? "), CHECK_OKAY_CANCEL)) {
if (!input_check_strict(player_ptr, _("それでも挑戦しますか? ", "Attempt it anyway? "), CHECK_OKAY_CANCEL)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-action/cmd-travel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void travel_flow(PlayerType *player_ptr, POSITION ty, POSITION tx)
void do_cmd_travel(PlayerType *player_ptr)
{
POSITION x, y;
if ((travel.x != 0) && (travel.y != 0) && (travel.x != player_ptr->x) && (travel.y != player_ptr->y) && get_check(_("トラベルを継続しますか?", "Do you continue to travel? "))) {
if ((travel.x != 0) && (travel.y != 0) && (travel.x != player_ptr->x) && (travel.y != player_ptr->y) && input_check(_("トラベルを継続しますか?", "Do you continue to travel? "))) {
y = travel.y;
x = travel.x;
} else if (!tgt_pt(player_ptr, &x, &y)) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-building/cmd-building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void bldg_process_command(PlayerType *player_ptr, building_type *bldg, in
building_recharge_all(player_ptr);
break;
case BACT_IDENTS:
if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay to identify all your possession? "))) {
if (!input_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay to identify all your possession? "))) {
break;
}
identify_pack(player_ptr);
Expand Down
4 changes: 2 additions & 2 deletions src/cmd-io/cmd-diary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void do_cmd_last_get(PlayerType *player_ptr)
}

const auto record = format(_("%sの入手を記録します。", "Do you really want to record getting %s? "), record_o_name);
if (!get_check(record)) {
if (!input_check(record)) {
return;
}

Expand All @@ -77,7 +77,7 @@ static void do_cmd_last_get(PlayerType *player_ptr)
*/
static void do_cmd_erase_diary()
{
if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your records? "))) {
if (!input_check(_("本当に記録を消去しますか?", "Do you really want to delete all your records? "))) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/cmd-item/cmd-destroy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static bool select_destroying_item(PlayerType *player_ptr, destroy_type *destroy
return true;
}

destroy_ptr->amt = get_quantity(destroy_ptr->o_ptr->number);
destroy_ptr->amt = input_quantity(destroy_ptr->o_ptr->number);
return destroy_ptr->amt > 0;
}

Expand Down
8 changes: 4 additions & 4 deletions src/cmd-item/cmd-equipment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ void do_cmd_wield(PlayerType *player_ptr)
case ItemKindType::POLEARM:
case ItemKindType::SWORD:
if (slot == INVEN_SUB_HAND) {
if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) {
if (!input_check(_("二刀流で戦いますか?", "Dual wielding? "))) {
slot = INVEN_MAIN_HAND;
}
} else if (!o_ptr_mh->is_valid() && has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) {
if (!input_check(_("二刀流で戦いますか?", "Dual wielding? "))) {
slot = INVEN_SUB_HAND;
}
} else if (o_ptr_mh->is_valid() && o_ptr_sh->is_valid()) {
Expand Down Expand Up @@ -238,7 +238,7 @@ void do_cmd_wield(PlayerType *player_ptr)
should_equip_cursed &= confirm_wear;
if (should_equip_cursed) {
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
if (!get_check(format(_("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), item_name.data()))) {
if (!input_check(format(_("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), item_name.data()))) {
return;
}
}
Expand All @@ -252,7 +252,7 @@ void do_cmd_wield(PlayerType *player_ptr)
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
constexpr auto mes = _("%sを装備すると吸血鬼になります。よろしいですか?",
"%s will transform you into a vampire permanently when equipped. Do you become a vampire? ");
if (!get_check(format(mes, item_name.data()))) {
if (!input_check(format(mes, item_name.data()))) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-item/cmd-item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void do_cmd_drop(PlayerType *player_ptr)
}

if (o_ptr->number > 1) {
amt = get_quantity(o_ptr->number);
amt = input_quantity(o_ptr->number);
if (amt <= 0) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/asking-player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ std::optional<std::string> input_string(std::string_view prompt, int len, std::s
*
* Note that "[y/n]" is appended to the prompt.
*/
bool get_check(std::string_view prompt)
bool input_check(std::string_view prompt)
{
return get_check_strict(p_ptr, prompt, 0);
return input_check_strict(p_ptr, prompt, 0);
}

/*
Expand All @@ -261,7 +261,7 @@ bool get_check(std::string_view prompt)
* mode & CHECK_NO_HISTORY : no message_add
* mode & CHECK_DEFAULT_Y : accept any key as y, except n and Esc.
*/
bool get_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS mode)
bool input_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS mode)
{
if (!rogue_like_commands) {
mode &= ~CHECK_OKAY_CANCEL;
Expand Down Expand Up @@ -367,7 +367,7 @@ std::optional<char> input_command(std::string_view prompt, bool z_escape)
*
* Hack -- allow "command_arg" to specify a quantity
*/
int get_quantity(int max, std::string_view initial_prompt)
int input_quantity(int max, std::string_view initial_prompt)
{
int amt;
if (command_arg) {
Expand Down
8 changes: 4 additions & 4 deletions src/core/asking-player.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <type_traits>

/*
* Bit flags for control of get_check_strict()
* Bit flags for control of input_check_strict()
*/
#define CHECK_OKAY_CANCEL 0x01
#define CHECK_NO_ESCAPE 0x02
Expand All @@ -16,10 +16,10 @@
class PlayerType;
bool askfor(char *buf, int len, bool numpad_cursor = true);
std::optional<std::string> input_string(std::string_view prompt, int len, std::string_view initial_value = "");
bool get_check(std::string_view prompt);
bool get_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS mode);
bool input_check(std::string_view prompt);
bool input_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS mode);
std::optional<char> input_command(std::string_view prompt, bool z_escape = false);
int get_quantity(int max, std::string_view initial_prompt = "");
int input_quantity(int max, std::string_view initial_prompt = "");
void pause_line(int row);
std::optional<int> input_integer(std::string_view prompt, int min, int max, int initial_value = 0);

Expand Down
4 changes: 2 additions & 2 deletions src/core/game-closer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void send_world_score_on_closing(PlayerType *player_ptr, bool do_send)
return;
}

if (!get_check_strict(
if (!input_check_strict(
player_ptr, _("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "), (CHECK_NO_ESCAPE | CHECK_NO_HISTORY))) {
return;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ void close_game(PlayerType *player_ptr)
print_tomb(player_ptr);

auto do_send = true;
if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? "))) {
if (!cheat_save || input_check(_("死んだデータをセーブしますか? ", "Save death? "))) {
update_playtime();
w_ptr->sf_play_time += w_ptr->play_time;

Expand Down
6 changes: 3 additions & 3 deletions src/core/game-play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void send_waiting_record(PlayerType *player_ptr)
return;
}

if (!get_check_strict(player_ptr, _("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY)) {
if (!input_check_strict(player_ptr, _("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY)) {
quit(0);
}

Expand All @@ -142,7 +142,7 @@ static void send_waiting_record(PlayerType *player_ptr)
/* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
parse_fixed_map(player_ptr, WILDERNESS_DEFINITION, 0, 0, w_ptr->max_wild_y, w_ptr->max_wild_x);
bool success = send_world_score(player_ptr, true);
if (!success && !get_check_strict(player_ptr, _("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY)) {
if (!success && !input_check_strict(player_ptr, _("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY)) {
prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
(void)inkey();
} else {
Expand Down Expand Up @@ -342,7 +342,7 @@ static void decide_arena_death(PlayerType *player_ptr)
while (true) {
char i;

if (!get_check(_("復活せずに何もかも諦めますか? ", "Do you give up everything without resurrection?? "))) {
if (!input_check(_("復活せずに何もかも諦めますか? ", "Do you give up everything without resurrection?? "))) {
cheat_death(player_ptr, cheat_live);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/scores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool send_world_score(PlayerType *player_ptr, bool do_send)
return true;
}

auto is_registration = get_check_strict(
auto is_registration = input_check_strict(
player_ptr, _("スコアをスコア・サーバに登録しますか? ", "Do you send score to the world score server? "), (CHECK_NO_ESCAPE | CHECK_NO_HISTORY));
if (!is_registration) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/dungeon/quest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ void do_cmd_quest(PlayerType *player_ptr)
}

msg_print(_("ここにはクエストへの入口があります。", "There is an entry of a quest."));
if (!get_check(_("クエストに入りますか?", "Do you enter? "))) {
if (!input_check(_("クエストに入りますか?", "Do you enter? "))) {
return;
}
if (is_echizen(player_ptr)) {
Expand Down
Loading

0 comments on commit 82a7b77

Please sign in to comment.