OSDN Git Service

[Refactor] #38997 get_check_strict() にplayer_type* 引数を追加した / Added player_type* argum...
authorHourier <hourier@users.sourceforge.jp>
Fri, 12 Jun 2020 17:09:10 +0000 (02:09 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 12 Jun 2020 17:09:57 +0000 (02:09 +0900)
15 files changed:
src/birth/birth-select-realm.c
src/birth/birth-wizard.c
src/cmd-action/cmd-spell.c
src/cmd/cmd-basic.c
src/core/game-closer.c
src/core/game-play.c
src/core/scores.c
src/floor/wild.c
src/inventory/inventory-curse.c
src/io/files-util.c
src/io/report.c
src/player/player-damage.c
src/spell-kind/spells-teleport.c
src/util/util.c
src/util/util.h

index 5f5adbe..1cf91cb 100644 (file)
@@ -280,14 +280,14 @@ static void cleanup_realm_selection_window(void)
  * @param count 魔法領域の数
  * @return 選んだ魔法領域で良ければTRUE、再選択ならばFALSE
  */
-static bool check_realm_selection(int count)
+static bool check_realm_selection(player_type *creature_ptr, int count)
 {
     if (count < 2) {
         prt(_("何かキーを押してください", "Hit any key."), 0, 0);
         (void)inkey();
         prt("", 0, 0);
         return TRUE;
-    } else if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
+    } else if (get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
         return TRUE;
 
     return FALSE;
@@ -329,7 +329,7 @@ bool get_player_realms(player_type *creature_ptr)
             }
         }
 
-        if (check_realm_selection(count))
+        if (check_realm_selection(creature_ptr, count))
             break;
     }
 
@@ -365,7 +365,7 @@ bool get_player_realms(player_type *creature_ptr)
             }
         }
 
-        if (check_realm_selection(count))
+        if (check_realm_selection(creature_ptr, count))
             break;
     }
 
index 257a044..4d4cc15 100644 (file)
@@ -162,7 +162,7 @@ static bool let_player_select_race(player_type *creature_ptr)
                 t += strlen(t) + 1;
             }
         }
-        if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
+        if (get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
             break;
 
         clear_from(10);
@@ -193,7 +193,7 @@ static bool let_player_select_class(player_type *creature_ptr)
             }
         }
 
-        if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
+        if (get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
             break;
 
         c_put_str(TERM_WHITE, "              ", 5, 15);
@@ -222,7 +222,7 @@ static bool let_player_select_personality(player_type *creature_ptr)
             }
         }
 
-        if (get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
+        if (get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_DEFAULT_Y))
             break;
 
         c_put_str(TERM_L_BLUE, creature_ptr->name, 1, 34);
index 06a2dfd..13f941f 100644 (file)
@@ -1150,7 +1150,7 @@ void do_cmd_cast(player_type *caster_ptr)
                if (!over_exert) return;
 
                /* Verify */
-               if (!get_check_strict(_("それでも挑戦しますか? ", "Attempt it anyway? "), CHECK_OKAY_CANCEL)) return;
+               if (!get_check_strict(caster_ptr, _("それでも挑戦しますか? ", "Attempt it anyway? "), CHECK_OKAY_CANCEL)) return;
        }
 
        /* Spell failure chance */
index 366120b..b572eb6 100644 (file)
@@ -2838,7 +2838,7 @@ void do_cmd_suicide(player_type *creature_ptr)
        if (current_world_ptr->total_winner)
        {
                /* Verify */
-               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
+               if (!get_check_strict(creature_ptr, _("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
        }
 
        /* Verify Suicide */
@@ -2873,7 +2873,7 @@ void do_cmd_suicide(player_type *creature_ptr)
                do
                {
                        while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
-               } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
+               } while (!get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
 
                if (buf[0])
                {
index b3bec2b..ad4fe80 100644 (file)
@@ -25,7 +25,7 @@ static void send_world_score_on_closing(player_type* player_ptr, bool do_send)
     if (send_world_score(player_ptr, do_send, update_playtime, display_player, map_name))
         return;
 
-    if (!get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
+    if (!get_check_strict(player_ptr, _("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
             (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
         return;
 
index 7736453..9c905bc 100644 (file)
@@ -116,7 +116,7 @@ void play_game(player_type *player_ptr, bool new_game)
         char buf[1024];
         bool success;
 
-        if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
+        if (!get_check_strict(player_ptr, _("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
             quit(0);
 
         player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
@@ -132,7 +132,7 @@ void play_game(player_type *player_ptr, bool new_game)
         parse_fixed_map(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
         success = send_world_score(player_ptr, TRUE, update_playtime, display_player, map_name);
 
-        if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY)) {
+        if (!success && !get_check_strict(player_ptr, _("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY)) {
             prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
             (void)inkey();
         } else {
index 6309270..b4d09b4 100644 (file)
@@ -440,7 +440,8 @@ bool send_world_score(player_type *current_player_ptr, bool do_send, void(*updat
                        return TRUE;
                }
                
-               bool is_registration = get_check_strict(_("スコアをスコア・サーバに登録しますか? ", "Do you send score to the world score server? "), (CHECK_NO_ESCAPE | CHECK_NO_HISTORY));
+               bool is_registration = get_check_strict(current_player_ptr,
+                    _("スコアをスコア・サーバに登録しますか? ", "Do you send score to the world score server? "), (CHECK_NO_ESCAPE | CHECK_NO_HISTORY));
                if (!is_registration) return FALSE;
 
                errr err;
index f2e5067..59e3365 100644 (file)
@@ -1152,7 +1152,7 @@ bool change_wild_mode(player_type *creature_ptr, bool encount)
                concptr msg = _("ペットを置いて広域マップに入りますか?",
                        "Do you leave your pets behind? ");
 
-               if (!get_check_strict(msg, CHECK_OKAY_CANCEL))
+               if (!get_check_strict(creature_ptr, msg, CHECK_OKAY_CANCEL))
                {
                        free_turn(creature_ptr);
                        return FALSE;
index a58d379..a7392ba 100644 (file)
@@ -165,7 +165,7 @@ static void curse_teleport(player_type *creature_ptr)
     o_ptr = &creature_ptr->inventory_list[i_keep];
     object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
     msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
-    if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL)) {
+    if (get_check_strict(creature_ptr, _("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL)) {
         disturb(creature_ptr, FALSE, TRUE);
         teleport_player(creature_ptr, 50, TELEPORT_SPONTANEOUS);
     } else {
index 3d72644..0d48a8f 100644 (file)
@@ -57,7 +57,7 @@ errr file_character(player_type *creature_ptr, concptr name, update_playtime_pf
                char out_val[160];
                (void)fd_close(fd);
                (void)sprintf(out_val, _("現存するファイル %s に上書きしますか? ", "Replace existing file %s? "), buf);
-               if (get_check_strict(out_val, CHECK_NO_HISTORY)) fd = -1;
+               if (get_check_strict(creature_ptr, out_val, CHECK_NO_HISTORY)) fd = -1;
        }
 
        FILE *fff = NULL;
index 4713281..e79672a 100644 (file)
@@ -457,9 +457,9 @@ errr report_score(player_type *creature_ptr, void(*update_playtime)(void), displ
                        (void)inkey();
 
 #ifdef JP
-                       if (!get_check_strict("もう一度接続を試みますか? ", CHECK_NO_HISTORY))
+                       if (!get_check_strict(creature_ptr, "もう一度接続を試みますか? ", CHECK_NO_HISTORY))
 #else
-                       if (!get_check_strict("Try again? ", CHECK_NO_HISTORY))
+                       if (!get_check_strict(creature_ptr, "Try again? ", CHECK_NO_HISTORY))
 #endif
                        {
 #ifdef WINDOWS
@@ -489,9 +489,9 @@ errr report_score(player_type *creature_ptr, void(*update_playtime)(void), displ
                        (void)inkey();
 
 #ifdef JP
-                       if (!get_check_strict("もう一度接続を試みますか? ", CHECK_NO_HISTORY))
+                       if (!get_check_strict(creature_ptr, "もう一度接続を試みますか? ", CHECK_NO_HISTORY))
 #else
-                       if (!get_check_strict("Try again? ", CHECK_NO_HISTORY))
+                       if (!get_check_strict(creature_ptr, "Try again? ", CHECK_NO_HISTORY))
 #endif
                        {
 #ifdef WINDOWS
index 950953c..8a0dc27 100644 (file)
@@ -493,7 +493,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
                        flush();
 
-                       if (get_check_strict(_("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
+                       if (get_check_strict(creature_ptr, _("画面を保存しますか?", "Dump the screen? "), CHECK_NO_HISTORY))
                        {
                                do_cmd_save_screen(creature_ptr, process_autopick_file_command);
                        }
@@ -533,7 +533,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 #else
                                        while (!get_string("Last word: ", death_message, 1024));
 #endif
-                               } while (winning_seppuku && !get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
+                               } while (winning_seppuku && !get_check_strict(creature_ptr, _("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
 
                                if (death_message[0] == '\0')
                                {
index c03a33a..a1f1a10 100644 (file)
@@ -525,7 +525,7 @@ void teleport_away_followable(player_type *tracer_ptr, MONSTER_IDX m_idx)
 
     if (!follow)
         return;
-    if (!get_check_strict(_("ついていきますか?", "Do you follow it? "), CHECK_OKAY_CANCEL))
+    if (!get_check_strict(tracer_ptr, _("ついていきますか?", "Do you follow it? "), CHECK_OKAY_CANCEL))
         return;
 
     if (one_in_(3)) {
index b2e4c37..2580ba4 100644 (file)
@@ -2712,7 +2712,7 @@ bool get_string(concptr prompt, char *buf, int len)
  */
 bool get_check(concptr prompt)
 {
-       return get_check_strict(prompt, 0);
+       return get_check_strict(p_ptr, prompt, 0);
 }
 
 
@@ -2724,13 +2724,13 @@ bool get_check(concptr 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(concptr prompt, BIT_FLAGS mode)
+bool get_check_strict(player_type *player_ptr, concptr prompt, BIT_FLAGS mode)
 {
        char buf[80];
        if (auto_more)
        {
-               p_ptr->window |= PW_MESSAGE;
-               handle_stuff(p_ptr);
+               player_ptr->window |= PW_MESSAGE;
+               handle_stuff(player_ptr);
                num_more = 0;
        }
 
@@ -2755,11 +2755,11 @@ bool get_check_strict(concptr prompt, BIT_FLAGS mode)
        }
 
        prt(buf, 0, 0);
-       if (!(mode & CHECK_NO_HISTORY) && p_ptr->playing)
+        if (!(mode & CHECK_NO_HISTORY) && player_ptr->playing)
        {
                message_add(buf);
-               p_ptr->window |= (PW_MESSAGE);
-               handle_stuff(p_ptr);
+               player_ptr->window |= (PW_MESSAGE);
+               handle_stuff(player_ptr);
        }
 
        bool flag = FALSE;
index 10b0b89..c447dfd 100644 (file)
@@ -286,7 +286,7 @@ extern bool get_string(concptr prompt, char *buf, int len);
 #define CHECK_NO_HISTORY  0x04
 #define CHECK_DEFAULT_Y   0x08
 extern bool get_check(concptr prompt);
-extern bool get_check_strict(concptr prompt, BIT_FLAGS mode);
+extern bool get_check_strict(player_type *player_ptr, concptr prompt, BIT_FLAGS mode);
 
 extern bool get_com(concptr prompt, char *command, bool z_escape);
 extern QUANTITY get_quantity(concptr prompt, QUANTITY max);