OSDN Git Service

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