term_fresh();
(void)strcpy(creature_ptr->died_from, _("(セーブ)", "(saved)"));
signals_ignore_tstp();
- if (save_player(creature_ptr, FALSE))
+ if (save_player(creature_ptr, SAVE_TYPE_NORMAL))
prt(_("ゲームをセーブしています... 終了", "Saving game... done."), 0, 0);
else
prt(_("ゲームをセーブしています... 失敗!", "Saving game... failed!"), 0, 0);
player_ptr->wait_report_score = TRUE;
player_ptr->is_dead = FALSE;
- if (!save_player(player_ptr, FALSE))
+ if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
msg_print(_("セーブ失敗!", "death save failed!"));
}
kingly(player_ptr);
if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? "))) {
- if (!save_player(player_ptr, FALSE))
+ if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
msg_print(_("セーブ失敗!", "death save failed!"));
} else
do_send = FALSE;
} else {
player_ptr->wait_report_score = FALSE;
top_twenty(player_ptr);
- if (!save_player(player_ptr, FALSE))
+ if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
msg_print(_("セーブ失敗!", "death save failed!"));
}
while (TRUE) {
if (!macro_running() && !command_new && auto_debug_save)
- save_player(player_ptr, TRUE);
+ save_player(player_ptr, SAVE_TYPE_DEBUG);
if (command_new) {
msg_erase();
signals_ignore_tstp();
- if (save_player(p_ptr, FALSE)) {
+ if (save_player(p_ptr, SAVE_TYPE_NORMAL)) {
term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ成功!", "Panic save succeeded!"));
} else {
term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ失敗!", "Panic save failed!"));
p_ptr->panic_save = 1;
signals_ignore_tstp();
(void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
- (void)save_player(p_ptr, FALSE);
+ (void)save_player(p_ptr, SAVE_TYPE_NORMAL);
quit(NULL);
return 0;
}
#ifdef JP
/* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
- if (!cheat_save && !save_player(creature_ptr, FALSE))
+ if (!cheat_save && !save_player(creature_ptr, SAVE_TYPE_NORMAL))
msg_print("セーブ失敗!");
#endif
* @brief ゲームオプション情報を書き込む / Write the "options"
* @return なし
*/
-void wr_options(void)
+void wr_options(save_type type)
{
for (int i = 0; i < 4; i++)
wr_u32b(0L);
if (cheat_diary_output)
c |= 0x8000;
+ if (type == SAVE_TYPE_DEBUG)
+ c |= 0xFFFF;
+
wr_u16b(c);
wr_byte(autosave_l);
previous_char.quick_ok = FALSE;
wr_byte((byte)previous_char.quick_ok);
-}
+}
\ No newline at end of file
#pragma once
+#include "save/save.h"
typedef struct store_type store_type;
void wr_store(store_type *store_ptr);
void wr_randomizer(void);
-void wr_options(void);
+void wr_options(save_type type);
void wr_ghost(void);
void save_quick_start(void);
* @param player_ptr プレーヤーへの参照ポインタ
* @return 成功すればtrue
*/
-static bool wr_savefile_new(player_type *player_ptr)
+static bool wr_savefile_new(player_type *player_ptr, save_type type)
{
compact_objects(player_ptr, 0);
compact_monsters(player_ptr, 0);
#endif
wr_randomizer();
- wr_options();
+ wr_options(type);
u32b tmp32u = message_num();
if (compress_savefile && (tmp32u > 40))
tmp32u = 40;
* @details
* Angband 2.8.0 will use "fd" instead of "fff" if possible
*/
-static bool save_player_aux(player_type *player_ptr, char *name)
+static bool save_player_aux(player_type *player_ptr, char *name, save_type type)
{
safe_setuid_grab(player_ptr);
int file_permission = 0644;
saving_savefile = angband_fopen(name, "wb");
safe_setuid_drop();
if (saving_savefile) {
- if (wr_savefile_new(player_ptr))
+ if (wr_savefile_new(player_ptr, type))
is_save_successful = TRUE;
if (angband_fclose(saving_savefile))
* @param player_ptr プレーヤーへの参照ポインタ
* @return 成功すればtrue
*/
-bool save_player(player_type *player_ptr, bool debug_save)
+bool save_player(player_type *player_ptr, save_type type)
{
char safe[1024];
strcpy(safe, savefile);
safe_setuid_drop();
update_playtime();
bool result = FALSE;
- if (save_player_aux(player_ptr, safe)) {
+ if (save_player_aux(player_ptr, safe, type)) {
char temp[1024];
char filename[1024];
strcpy(temp, savefile);
safe_setuid_grab(player_ptr);
fd_kill(temp);
strcpy(filename, savefile);
- if (debug_save)
+ if (type == SAVE_TYPE_DEBUG)
strcat(filename, ".debug");
fd_move(filename, temp);
fd_move(safe, filename);
#include "floor/floor-save.h"
#include "system/angband.h"
-bool save_player(player_type *player_ptr, bool debug_save);
+typedef enum save_type {
+ SAVE_TYPE_NORMAL = 0,
+ SAVE_TYPE_DEBUG = 1
+}save_type;
+
+bool save_player(player_type *player_ptr, save_type type);