OSDN Git Service

Included view/display-messages.h to pick up declaration of msg_flag.
[hengband/hengband.git] / src / io / exit-panic.c
1 /*!
2  * @brief 異常発生時のゲーム緊急終了処理
3  * @date 2020/03/01
4  * @author Hourier
5  * @details
6  * Windowsのコードからは呼ばれない。よってVSからは見えない
7  */
8
9 #include "exit-panic.h"
10 #include "world/world.h"
11 #include "player-move.h"
12 #include "signal-handlers.h"
13 #include "save.h"
14 #include "view/display-messages.h"
15
16 /*!
17  * @brief Handle abrupt death of the visual system
18  * @param creature_ptr プレーヤーへの参照ポインタ
19  * @return なし
20  * @details
21  * This routine is called only in very rare situations, and only
22  * by certain visual systems, when they experience fatal errors.
23  */
24 void exit_game_panic(player_type *creature_ptr)
25 {
26         if (!current_world_ptr->character_generated || current_world_ptr->character_saved)
27                 quit(_("緊急事態", "panic"));
28         msg_flag = FALSE;
29
30         prt("", 0, 0);
31         disturb(creature_ptr, TRUE, TRUE);
32         if (creature_ptr->chp < 0) creature_ptr->is_dead = FALSE;
33
34         creature_ptr->panic_save = 1;
35         signals_ignore_tstp();
36         (void)strcpy(creature_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
37         if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
38         quit(_("緊急セーブ成功!", "panic save succeeded!"));
39 }