1 #include "core/game-closer.h"
2 #include "cmd-io/cmd-save.h"
3 #include "core/asking-player.h"
4 #include "core/scores.h"
5 #include "core/stuff-handler.h"
6 #include "game-option/cheat-options.h"
7 #include "io/input-key-acceptor.h"
8 #include "io/signal-handlers.h"
9 #include "io/uid-checker.h"
10 #include "main/music-definitions-table.h"
11 #include "main/sound-of-music.h"
12 #include "player/process-death.h"
13 #include "savedata/save.h"
14 #include "term/screen-processor.h"
15 #include "util/angband-files.h"
16 #include "util/int-char-converter.h"
17 #include "view/display-messages.h"
18 #include "view/display-player.h"
19 #include "world/world.h"
21 static void clear_floor(player_type *player_ptr)
23 (void)fd_close(highscore_fd);
25 clear_saved_floor_files(player_ptr);
26 signals_handle_tstp();
29 static void send_world_score_on_closing(player_type *player_ptr, bool do_send)
31 if (send_world_score(player_ptr, do_send, update_playtime, display_player))
34 if (!get_check_strict(
35 player_ptr, _("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "), (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
38 player_ptr->wait_report_score = TRUE;
39 player_ptr->is_dead = FALSE;
40 if (!save_player(player_ptr))
41 msg_print(_("セーブ失敗!", "death save failed!"));
44 static bool check_death(player_type *player_ptr)
46 if (player_ptr->is_dead)
49 do_cmd_save_game(player_ptr, FALSE);
50 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
51 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
52 if (inkey() != ESCAPE)
53 predict_score(player_ptr);
55 clear_floor(player_ptr);
61 * Close up the current game (player may or may not be dead)
62 * @param creature_ptr プレーヤーへの参照ポインタ
66 * This function is called only from "main.c" and "signals.c".
69 void close_game(player_type *player_ptr)
72 handle_stuff(player_ptr);
75 signals_ignore_tstp();
77 current_world_ptr->character_icky = TRUE;
79 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
80 safe_setuid_grab(player_ptr);
81 highscore_fd = fd_open(buf, O_RDWR);
84 if (!check_death(player_ptr))
87 if (current_world_ptr->total_winner)
90 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? "))) {
91 if (!save_player(player_ptr))
92 msg_print(_("セーブ失敗!", "death save failed!"));
96 print_tomb(player_ptr);
98 show_death_info(player_ptr, update_playtime, display_player);
100 if (check_score(player_ptr)) {
101 send_world_score_on_closing(player_ptr, do_send);
102 if (!player_ptr->wait_report_score)
103 (void)top_twenty(player_ptr);
104 } else if (highscore_fd >= 0) {
105 display_scores_aux(0, 10, -1, NULL);
108 clear_floor(player_ptr);