OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-mind-edits' into feature...
[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 "io/exit-panic.h"
10 #include "core/disturbance.h"
11 #include "world/world.h"
12 #include "player/player-move.h"
13 #include "io/signal-handlers.h"
14 #include "save/save.h"
15 #include "term/screen-processor.h"
16 #include "view/display-messages.h"
17
18 /*!
19  * @brief Handle abrupt death of the visual system
20  * @param creature_ptr プレーヤーへの参照ポインタ
21  * @return なし
22  * @details
23  * This routine is called only in very rare situations, and only
24  * by certain visual systems, when they experience fatal errors.
25  */
26 void exit_game_panic(player_type *creature_ptr)
27 {
28         if (!current_world_ptr->character_generated || current_world_ptr->character_saved)
29                 quit(_("緊急事態", "panic"));
30         msg_flag = FALSE;
31
32         prt("", 0, 0);
33         disturb(creature_ptr, TRUE, TRUE);
34         if (creature_ptr->chp < 0) creature_ptr->is_dead = FALSE;
35
36         creature_ptr->panic_save = 1;
37         signals_ignore_tstp();
38         (void)strcpy(creature_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
39         if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
40         quit(_("緊急セーブ成功!", "panic save succeeded!"));
41 }