OSDN Git Service

[Refactor] #40236 Separated ask_html_dump from do_cmd_save_screen()
authorHourier <hourier@users.sourceforge.jp>
Wed, 22 Apr 2020 10:04:14 +0000 (19:04 +0900)
committerHourier <hourier@users.sourceforge.jp>
Wed, 22 Apr 2020 10:04:14 +0000 (19:04 +0900)
src/cmd/cmd-process-screen.c

index deae6fe..009c982 100644 (file)
@@ -176,32 +176,46 @@ static void do_cmd_save_screen_html(void)
 }
 
 
-/*
- * Save a screen dump to a file
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @return なし
+/*!
+ * @brief HTMLで記念撮影するかを問い合わせる
+ * @param なし
+ * @return HTMLでダンプするならTRUE
  */
-void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*))
+static bool ask_html_dump(void)
 {
-       prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
-       bool html_dump = FALSE;
        while (TRUE)
        {
                char c = inkey();
                if (c == 'Y' || c == 'y')
-                       break;
+               {
+                       return FALSE;
+               }
                else if (c == 'H' || c == 'h')
                {
-                       html_dump = TRUE;
-                       break;
+                       return TRUE;
                }
                else
                {
                        prt("", 0, 0);
-                       return;
+                       return FALSE;
                }
        }
 
+       // コンパイル警告対応.
+       return FALSE;
+}
+
+
+/*
+ * Save a screen dump to a file
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
+void do_cmd_save_screen(player_type *creature_ptr, void(*handle_stuff)(player_type*))
+{
+       prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
+       bool html_dump = ask_html_dump();
+
        int wid, hgt;
        Term_get_size(&wid, &hgt);