OSDN Git Service

[Fix] #40233 auto_dump_stream ファイルディスクリプタ周りをビルドが通るように展開. / Expand so that the build...
[hengband/hengband.git] / src / cmd / cmd-save.c
1 #include "signal-handlers.h"
2 #include "io/write-diary.h"
3 #include "cmd/cmd-save.h"
4 #include "cmd/cmd-dump.h"
5 #include "player-move.h"
6 #include "core.h" // 暫定。後で消す.
7 #include "save.h"
8 #include "world.h"
9 #include "monster-status.h" // 違和感。要調査.
10 #include "term.h"
11
12 /*!
13  * @brief セーブするコマンドのメインルーチン
14  * Save the game
15  * @param creature_ptr プレーヤーへの参照ポインタ
16  * @param is_autosave オートセーブ中の処理ならばTRUE
17  * @return なし
18  * @details
19  */
20 void do_cmd_save_game(player_type *creature_ptr, int is_autosave)
21 {
22         if (is_autosave)
23         {
24                 msg_print(_("自動セーブ中", "Autosaving the game..."));
25         }
26         else
27         {
28                 disturb(creature_ptr, TRUE, TRUE);
29         }
30
31         msg_print(NULL);
32         handle_stuff(creature_ptr);
33         prt(_("ゲームをセーブしています...", "Saving game..."), 0, 0);
34         Term_fresh();
35         (void)strcpy(creature_ptr->died_from, _("(セーブ)", "(saved)"));
36         signals_ignore_tstp();
37         if (save_player(creature_ptr))
38         {
39                 prt(_("ゲームをセーブしています... 終了", "Saving game... done."), 0, 0);
40         }
41         else
42         {
43                 prt(_("ゲームをセーブしています... 失敗!", "Saving game... failed!"), 0, 0);
44         }
45
46         signals_handle_tstp();
47         Term_fresh();
48         (void)strcpy(creature_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
49         current_world_ptr->is_loading_now = FALSE;
50         update_creature(creature_ptr);
51         mproc_init(creature_ptr->current_floor_ptr);
52         current_world_ptr->is_loading_now = TRUE;
53 }
54
55
56 /*!
57  * @brief セーブ後にゲーム中断フラグを立てる/
58  * Save the game and exit
59  * @return なし
60  * @details
61  */
62 void do_cmd_save_and_exit(player_type *creature_ptr)
63 {
64         creature_ptr->playing = FALSE;
65         creature_ptr->leaving = TRUE;
66         exe_write_diary(creature_ptr, DIARY_GAMESTART, 0, _("----ゲーム中断----", "--- Saved and Exited Game ---"));
67 }