OSDN Git Service

[Refactor] #39962 Separated exit-panic.c/h from files.c
authorHourier <hourier@users.sourceforge.jp>
Sun, 1 Mar 2020 10:06:29 +0000 (19:06 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 1 Mar 2020 10:06:29 +0000 (19:06 +0900)
src/Makefile.am
src/files.c
src/files.h
src/io/exit-panic.c [new file with mode: 0644]
src/io/exit-panic.h [new file with mode: 0644]
src/main-cap.c
src/main-gcu.c

index d7e228d..56354a6 100644 (file)
@@ -30,6 +30,7 @@ hengband_SOURCES = \
        io/gf-descriptions.c io/gf-descriptions.h \
        io/tokenizer.c io/tokenizer.h \
        io/process-pref-file.c io/process-pref-file.h \
+       io/exit-panic.c io/exit-panic.h \
        signal-handlers.c signal-handlers.h uid-checker.c uid-checker.h \
        character-dump.c character-dump.h core.c core.h files.c files.h \
        \
index 77f4d96..46d06ac 100644 (file)
@@ -1034,33 +1034,6 @@ void do_cmd_save_and_exit(player_type *creature_ptr)
 
 
 /*!
- * @brief 異常発生時のゲーム緊急終了処理 /
- * Handle abrupt death of the visual system
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @return なし
- * @details
- * This routine is called only in very rare situations, and only
- * by certain visual systems, when they experience fatal errors.
- */
-void exit_game_panic(player_type *creature_ptr)
-{
-       if (!current_world_ptr->character_generated || current_world_ptr->character_saved)
-               quit(_("緊急事態", "panic"));
-       msg_flag = FALSE;
-
-       prt("", 0, 0);
-       disturb(creature_ptr, TRUE, TRUE);
-       if (creature_ptr->chp < 0) creature_ptr->is_dead = FALSE;
-
-       creature_ptr->panic_save = 1;
-       signals_ignore_tstp();
-       (void)strcpy(creature_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
-       if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
-       quit(_("緊急セーブ成功!", "panic save succeeded!"));
-}
-
-
-/*!
  * @brief ファイルからランダムに行を一つ取得する /
  * Get a random line from a file
  * @param file_name ファイル名
index 21d5641..c7672cf 100644 (file)
@@ -28,7 +28,6 @@ extern errr process_histpref_file(player_type *creature_ptr, concptr name);
 extern bool show_file(player_type *player_ptr, bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode);
 extern void do_cmd_save_game(player_type *creature_ptr, int is_autosave);
 extern void do_cmd_save_and_exit(player_type *player_ptr);
-extern void exit_game_panic(player_type *creature_ptr);
 extern errr get_rnd_line(concptr file_name, int entry, char *output);
 void read_dead_file(char* buf, size_t buf_size);
 
diff --git a/src/io/exit-panic.c b/src/io/exit-panic.c
new file mode 100644 (file)
index 0000000..42a4f9c
--- /dev/null
@@ -0,0 +1,38 @@
+/*!
+ * @brief 異常発生時のゲーム緊急終了処理
+ * @date 2020/03/01
+ * @author Hourier
+ * @details
+ * Windowsのコードからは呼ばれない。よってVSからは見えない
+ */
+
+#include "exit-panic.h"
+#include "world.h"
+#include "player-move.h"
+#include "signal-handlers.h"
+#include "save.h"
+
+/*!
+ * @brief Handle abrupt death of the visual system
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ * @details
+ * This routine is called only in very rare situations, and only
+ * by certain visual systems, when they experience fatal errors.
+ */
+void exit_game_panic(player_type *creature_ptr)
+{
+       if (!current_world_ptr->character_generated || current_world_ptr->character_saved)
+               quit(_("緊急事態", "panic"));
+       msg_flag = FALSE;
+
+       prt("", 0, 0);
+       disturb(creature_ptr, TRUE, TRUE);
+       if (creature_ptr->chp < 0) creature_ptr->is_dead = FALSE;
+
+       creature_ptr->panic_save = 1;
+       signals_ignore_tstp();
+       (void)strcpy(creature_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
+       if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
+       quit(_("緊急セーブ成功!", "panic save succeeded!"));
+}
diff --git a/src/io/exit-panic.h b/src/io/exit-panic.h
new file mode 100644 (file)
index 0000000..bcdc94e
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma once
+/*
+ * Windows\82Ì\83R\81[\83h\82©\82ç\82Í\8cÄ\82Î\82ê\82È\82¢\81B\82æ\82Á\82ÄVS\82©\82ç\82Í\8c©\82¦\82È\82¢
+ */
+
+#include "angband.h"
+
+void exit_game_panic(player_type *creature_ptr);
index ecbc6a8..822c882 100644 (file)
@@ -3,6 +3,7 @@
 /* Purpose: Support for "term.c" using "termcap" calls */
 
 #include "angband.h"
+#include "io/exit-panic.h"
 
 #ifdef USE_CAP
 
index f2a6368..8d2b036 100644 (file)
  */
 
 #include "angband.h"
+#include "io/exit-panic.h"
 #include "files.h"
 #include "term.h"