OSDN Git Service

[Refactor] #3461 get_string() をinput_string() に改名した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 24 Jun 2023 15:56:39 +0000 (00:56 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Tue, 27 Jun 2023 08:42:50 +0000 (17:42 +0900)
19 files changed:
src/artifact/random-art-generator.cpp
src/cmd-action/cmd-move.cpp
src/cmd-action/cmd-others.cpp
src/cmd-action/cmd-pet.cpp
src/cmd-io/cmd-diary.cpp
src/cmd-io/cmd-dump.cpp
src/cmd-io/cmd-lore.cpp
src/cmd-io/cmd-process-screen.cpp
src/cmd-item/cmd-item.cpp
src/cmd-visual/cmd-draw.cpp
src/core/asking-player.cpp
src/core/asking-player.h
src/core/show-file.cpp
src/io/record-play-movie.cpp
src/market/building-monster.cpp
src/player/player-damage.cpp
src/player/process-name.cpp
src/wizard/wizard-item-modifier.cpp
src/wizard/wizard-spells.cpp

index 97bc1da..025fa6f 100644 (file)
@@ -402,7 +402,7 @@ static std::string name_unnatural_random_artifact(PlayerType *player_ptr, ItemEn
         return ss.str();
     };
     char new_name[160] = "";
-    if (!get_string(ask_msg, new_name, sizeof new_name) || !new_name[0]) {
+    if (!input_string(ask_msg, new_name, sizeof new_name) || !new_name[0]) {
         if (one_in_(2)) {
             return wrap_name(get_table_sindarin_aux());
         } else {
index 7bb1e90..f8cd421 100644 (file)
@@ -463,7 +463,7 @@ void do_cmd_rest(PlayerType *player_ptr)
         concptr p = _("休憩 (0-9999, '*' で HP/MP全快, '&' で必要なだけ): ", "Rest (0-9999, '*' for HP/SP, '&' as needed): ");
         char out_val[80];
         strcpy(out_val, "&");
-        if (!get_string(p, out_val, 4)) {
+        if (!input_string(p, out_val, 4)) {
             return;
         }
 
index 825554f..36275ac 100644 (file)
@@ -150,7 +150,7 @@ static void accept_winner_message(PlayerType *player_ptr)
     char buf[1024] = "";
     play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
     do {
-        while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof(buf))) {
+        while (!input_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof(buf))) {
             ;
         }
     } while (!get_check_strict(player_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
index f61687b..dd1084f 100644 (file)
@@ -360,7 +360,7 @@ static void do_name_pet(PlayerType *player_ptr)
         }
 
         /* Get a new inscription (possibly empty) */
-        if (get_string(_("名前: ", "Name: "), out_val, 15)) {
+        if (input_string(_("名前: ", "Name: "), out_val, 15)) {
             if (out_val[0]) {
                 /* Save the inscription */
                 m_ptr->nickname = out_val;
index e20dfb5..83cafa8 100644 (file)
@@ -47,7 +47,7 @@ static void display_diary(PlayerType *player_ptr)
 static void add_diary_note(PlayerType *player_ptr)
 {
     char tmp[80]{};
-    if (get_string(_("内容: ", "diary note: "), tmp, 79)) {
+    if (input_string(_("内容: ", "diary note: "), tmp, 79)) {
         exe_write_diary(player_ptr, DiaryKind::DESCRIPTION, 0, tmp);
     }
 }
index c4f0a94..fe2d63e 100644 (file)
@@ -52,7 +52,7 @@ void do_cmd_pref(PlayerType *player_ptr)
 {
     char buf[80];
     strcpy(buf, "");
-    if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) {
+    if (!input_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) {
         return;
     }
 
@@ -200,7 +200,7 @@ void do_cmd_note(void)
 {
     char buf[80];
     strcpy(buf, "");
-    if (!get_string(_("メモ: ", "Note: "), buf, 60)) {
+    if (!input_string(_("メモ: ", "Note: "), buf, 60)) {
         return;
     }
     if (!buf[0] || (buf[0] == ' ')) {
index 9574c75..4ec77bd 100644 (file)
@@ -77,7 +77,7 @@ void do_cmd_query_symbol(PlayerType *player_ptr)
         buf = _("乗馬可能モンスターのリスト", "Ridable monster list.");
     } else if (sym == KTRL('M')) {
         all = true;
-        if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"), temp, 70)) {
+        if (!input_string(_("名前(英語の場合小文字で可)", "Enter name:"), temp, 70)) {
             temp[0] = 0;
             return;
         }
index c65f23c..a0dc163 100644 (file)
@@ -236,7 +236,7 @@ void exe_cmd_save_screen_html(const std::filesystem::path &path, bool need_messa
 static void exe_cmd_save_screen_html_with_naming()
 {
     char tmp[256] = "screen.html";
-    if (!get_string(_("ファイル名: ", "File name: "), tmp, 80)) {
+    if (!input_string(_("ファイル名: ", "File name: "), tmp, 80)) {
         return;
     }
 
index 79d8127..74b7259 100644 (file)
@@ -229,7 +229,7 @@ void do_cmd_inscribe(PlayerType *player_ptr)
         angband_strcpy(out_val, o_ptr->inscription.value(), MAX_INSCRIPTION);
     }
 
-    if (get_string(_("銘: ", "Inscription: "), out_val, MAX_INSCRIPTION)) {
+    if (input_string(_("銘: ", "Inscription: "), out_val, MAX_INSCRIPTION)) {
         o_ptr->inscription.emplace(out_val);
         auto &rfu = RedrawingFlagsUpdater::get_instance();
         static constexpr auto flags_srf = {
index db908a1..fcc156b 100644 (file)
@@ -127,7 +127,7 @@ void do_cmd_player_status(PlayerType *player_ptr)
             process_player_name(player_ptr);
         } else if (c == 'f') {
             strnfmt(tmp, sizeof(tmp), "%s.txt", player_ptr->base_name);
-            if (get_string(_("ファイル名: ", "File name: "), tmp, 80)) {
+            if (input_string(_("ファイル名: ", "File name: "), tmp, 80)) {
                 if (tmp[0] && (tmp[0] != ' ')) {
                     update_playtime();
                     file_character(player_ptr, tmp);
index 79bd3f2..f8ba64e 100644 (file)
@@ -226,7 +226,7 @@ bool askfor(char *buf, int len, bool numpad_cursor)
  *
  * We clear the input, and return FALSE, on "ESCAPE".
  */
-bool get_string(std::string_view prompt, char *buf, int len)
+bool input_string(std::string_view prompt, char *buf, int len)
 {
     bool res;
     msg_print(nullptr);
@@ -457,7 +457,7 @@ std::optional<int> input_integer(std::string_view prompt, int min, int max, int
     ss << prompt << "(" << min << "-" << max << "): ";
     auto digit = std::max(std::to_string(min).length(), std::to_string(max).length());
     while (true) {
-        if (!get_string(ss.str().data(), tmp_val, digit)) {
+        if (!input_string(ss.str().data(), tmp_val, digit)) {
             return std::nullopt;
         }
 
index 8eb41c6..9741037 100644 (file)
@@ -15,7 +15,7 @@
 
 class PlayerType;
 bool askfor(char *buf, int len, bool numpad_cursor = true);
-bool get_string(std::string_view prompt, char *buf, int len);
+bool input_string(std::string_view prompt, char *buf, int len);
 bool get_check(std::string_view prompt);
 bool get_check_strict(PlayerType *player_ptr, std::string_view prompt, BIT_FLAGS mode);
 bool get_com(std::string_view prompt, char *command, bool z_escape);
index c3f18b8..25a5e9b 100644 (file)
@@ -466,7 +466,7 @@ bool show_file(PlayerType *player_ptr, bool show_version, std::string_view name_
             FILE *ffp;
             char xtmp[81] = "";
 
-            if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) {
+            if (!input_string(_("ファイル名: ", "File name: "), xtmp, 80)) {
                 continue;
             }
 
index b7ac55e..c38ffc7 100644 (file)
@@ -343,7 +343,7 @@ void prepare_movie_hooks(PlayerType *player_ptr)
     std::stringstream ss;
     ss << player_ptr->base_name << ".amv";
     auto movie_filename = ss.str();
-    if (!get_string(_("ムービー記録ファイル: ", "Movie file name: "), movie_filename.data(), 80)) {
+    if (!input_string(_("ムービー記録ファイル: ", "Movie file name: "), movie_filename.data(), 80)) {
         return;
     }
 
index d54835d..79f9a0d 100644 (file)
@@ -66,7 +66,7 @@ bool research_mon(PlayerType *player_ptr)
         buf = _("ユニーク外モンスターのリスト", "Non-unique monster list.");
     } else if (sym == KTRL('M')) {
         all = true;
-        if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"), temp, 70)) {
+        if (!input_string(_("名前(英語の場合小文字で可)", "Enter name:"), temp, 70)) {
             temp[0] = 0;
             screen_load();
 
index 19b399f..8469d09 100644 (file)
@@ -475,11 +475,11 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
                 angband_strcpy(player_last_words, death_message, max_last_words);
                 do {
 #ifdef JP
-                    while (!get_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", player_last_words, max_last_words)) {
+                    while (!input_string(winning_seppuku ? "辞世の句: " : "断末魔の叫び: ", player_last_words, max_last_words)) {
                         ;
                     }
 #else
-                    while (!get_string("Last words: ", player_last_words, max_last_words)) {
+                    while (!input_string("Last words: ", player_last_words, max_last_words)) {
                         ;
                     }
 #endif
index b3c6dd6..63a7160 100644 (file)
@@ -135,7 +135,7 @@ void get_name(PlayerType *player_ptr)
     char tmp[64];
     strcpy(tmp, player_ptr->name);
 
-    if (get_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15)) {
+    if (input_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15)) {
         strcpy(player_ptr->name, tmp);
     }
 
index d44e10f..b881f42 100644 (file)
@@ -872,7 +872,7 @@ WishResultType do_cmd_wishing(PlayerType *player_ptr, int prob, bool allow_art,
     bool fixed = true;
 
     while (1) {
-        if (get_string(_("何をお望み? ", "For what do you wish?"), buf, (MAX_NLEN - 1))) {
+        if (input_string(_("何をお望み? ", "For what do you wish?"), buf, (MAX_NLEN - 1))) {
             break;
         }
         if (confirm) {
index 55421fc..2c9add8 100644 (file)
@@ -62,7 +62,7 @@ static const std::vector<debug_spell_command> debug_spell_commands_list = {
 void wiz_debug_spell(PlayerType *player_ptr)
 {
     char tmp_val[50] = "\0";
-    if (!get_string("SPELL: ", tmp_val, 32)) {
+    if (!input_string("SPELL: ", tmp_val, 32)) {
         return;
     }