OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-Riding-Teleport' into develop
authordeskull <deskull@users.sourceforge.jp>
Fri, 5 Feb 2021 11:25:53 +0000 (20:25 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 5 Feb 2021 11:25:53 +0000 (20:25 +0900)
21 files changed:
src/cmd-io/cmd-save.c
src/core/game-closer.c
src/core/game-play.c
src/game-option/game-play-options.c
src/game-option/game-play-options.h
src/game-option/option-types-table.c
src/game-option/option-types-table.h
src/io/exit-panic.c
src/io/files-util.c
src/io/files-util.h
src/io/input-key-requester.c
src/io/signal-handlers.c
src/main-win.c
src/main/angband-initializer.c
src/player/player-damage.c
src/player/process-name.c
src/save/info-writer.c
src/save/info-writer.h
src/save/save.c
src/save/save.h
src/term/z-term.h

index f709dc5..87090c7 100644 (file)
  */
 void do_cmd_save_game(player_type *creature_ptr, int is_autosave)
 {
-       if (is_autosave)
-               msg_print(_("自動セーブ中", "Autosaving the game..."));
-       else
-               disturb(creature_ptr, TRUE, TRUE);
+    if (is_autosave)
+        msg_print(_("自動セーブ中", "Autosaving the game..."));
+    else
+        disturb(creature_ptr, TRUE, TRUE);
 
-       msg_print(NULL);
-       handle_stuff(creature_ptr);
-       prt(_("ゲームをセーブしています...", "Saving game..."), 0, 0);
-       term_fresh();
-       (void)strcpy(creature_ptr->died_from, _("(セーブ)", "(saved)"));
-       signals_ignore_tstp();
-       if (save_player(creature_ptr))
-               prt(_("ゲームをセーブしています... 終了", "Saving game... done."), 0, 0);
-       else
-               prt(_("ゲームをセーブしています... 失敗!", "Saving game... failed!"), 0, 0);
+    msg_print(NULL);
+    handle_stuff(creature_ptr);
+    prt(_("ゲームをセーブしています...", "Saving game..."), 0, 0);
+    term_fresh();
+    (void)strcpy(creature_ptr->died_from, _("(セーブ)", "(saved)"));
+    signals_ignore_tstp();
+    if (save_player(creature_ptr, SAVE_TYPE_NORMAL))
+        prt(_("ゲームをセーブしています... 終了", "Saving game... done."), 0, 0);
+    else
+        prt(_("ゲームをセーブしています... 失敗!", "Saving game... failed!"), 0, 0);
 
-       signals_handle_tstp();
-       term_fresh();
-       (void)strcpy(creature_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
-       current_world_ptr->is_loading_now = FALSE;
-       update_creature(creature_ptr);
-       mproc_init(creature_ptr->current_floor_ptr);
-       current_world_ptr->is_loading_now = TRUE;
+    signals_handle_tstp();
+    term_fresh();
+    (void)strcpy(creature_ptr->died_from, _("(元気に生きている)", "(alive and well)"));
+    current_world_ptr->is_loading_now = FALSE;
+    update_creature(creature_ptr);
+    mproc_init(creature_ptr->current_floor_ptr);
+    current_world_ptr->is_loading_now = TRUE;
 }
 
-
 /*!
  * @brief セーブ後にゲーム中断フラグを立てる/
  * Save the game and exit
@@ -54,7 +53,7 @@ void do_cmd_save_game(player_type *creature_ptr, int is_autosave)
  */
 void do_cmd_save_and_exit(player_type *creature_ptr)
 {
-       creature_ptr->playing = FALSE;
-       creature_ptr->leaving = TRUE;
-       exe_write_diary(creature_ptr, DIARY_GAMESTART, 0, _("----ゲーム中断----", "--- Saved and Exited Game ---"));
-}
+    creature_ptr->playing = FALSE;
+    creature_ptr->leaving = TRUE;
+    exe_write_diary(creature_ptr, DIARY_GAMESTART, 0, _("----ゲーム中断----", "--- Saved and Exited Game ---"));
+}
\ No newline at end of file
index 1ed65e1..cc25a86 100644 (file)
@@ -37,11 +37,10 @@ static void send_world_score_on_closing(player_type *player_ptr, bool do_send)
 
     player_ptr->wait_report_score = TRUE;
     player_ptr->is_dead = FALSE;
-    if (!save_player(player_ptr))
+    if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
         msg_print(_("セーブ失敗!", "death save failed!"));
 }
 
-
 /*!
  * @brief ゲームクローズ時、プレイヤーが死亡しているかのチェックを行い死亡していないならば、確認キー入力とスコア表示、現フロアの初期化を行う。
  * @param player_ptr プレイヤー構造体参照ポインタ。
@@ -94,7 +93,7 @@ void close_game(player_type *player_ptr)
         kingly(player_ptr);
 
     if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? "))) {
-        if (!save_player(player_ptr))
+        if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
             msg_print(_("セーブ失敗!", "death save failed!"));
     } else
         do_send = FALSE;
@@ -112,4 +111,4 @@ void close_game(player_type *player_ptr)
     }
 
     clear_floor(player_ptr);
-}
+}
\ No newline at end of file
index 3cc8ea8..393cfd9 100644 (file)
 #include "grid/feature.h"
 #include "grid/grid.h"
 #include "info-reader/fixed-map-parser.h"
-#include "io/record-play-movie.h"
 #include "io/inet.h"
 #include "io/input-key-acceptor.h"
 #include "io/input-key-processor.h"
 #include "io/read-pref-file.h"
+#include "io/record-play-movie.h"
 #include "io/screen-util.h"
 #include "io/signal-handlers.h"
 #include "io/write-diary.h"
@@ -129,7 +129,7 @@ static void send_waiting_record(player_type *player_ptr)
     } else {
         player_ptr->wait_report_score = FALSE;
         top_twenty(player_ptr);
-        if (!save_player(player_ptr))
+        if (!save_player(player_ptr, SAVE_TYPE_NORMAL))
             msg_print(_("セーブ失敗!", "death save failed!"));
     }
 
@@ -226,7 +226,7 @@ static void set_wizard_mode_by_argument(player_type *player_ptr)
 
         return;
     }
-    
+
     if (player_ptr->is_dead)
         quit("Already dead.");
 }
@@ -329,7 +329,7 @@ static void decide_arena_death(player_type *player_ptr)
         if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
             cheat_death(player_ptr);
 
-        return;    
+        return;
     }
 
     floor_ptr->inside_arena = FALSE;
@@ -409,7 +409,7 @@ void play_game(player_type *player_ptr, bool new_game, bool browsing_movie)
         init_world_floor_info(player_ptr);
     else
         restore_world_floor_info(player_ptr);
-    
+
     generate_world(player_ptr, new_game);
     player_ptr->playing = TRUE;
     reset_visuals(player_ptr, process_autopick_file_command);
@@ -431,4 +431,4 @@ void play_game(player_type *player_ptr, bool new_game, bool browsing_movie)
     process_game_turn(player_ptr);
     close_game(player_ptr);
     quit(NULL);
-}
+}
\ No newline at end of file
index 364ac8b..f3f9f91 100644 (file)
@@ -9,6 +9,7 @@ bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
 bool last_words; /* Leave last words when your character dies */
 bool auto_dump; /* Dump a character record automatically */
+bool auto_debug_save; /* Dump a debug savedata every key input */
 #ifdef WORLD_SCORE
 bool send_score; /* Send score dump to the world score server */
 #endif
index 5c3e09a..ae88f62 100644 (file)
@@ -11,6 +11,7 @@ extern bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 extern bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
 extern bool last_words; /* Leave last words when your character dies */
 extern bool auto_dump; /* Dump a character record automatically */
+extern bool auto_debug_save; /* Dump a debug savedata every key input */
 #ifdef WORLD_SCORE
 extern bool send_score; /* Send score dump to the world score server */
 #endif
index 979c38f..730b5f8 100644 (file)
@@ -153,6 +153,8 @@ const option_type option_info[MAX_OPTION_INFO] = {
     { &send_score, TRUE, OPT_PAGE_GAMEPLAY, 4, 6, "send_score", _("スコアサーバにスコアを送る", "Send score dump to the world score server") },
 #endif
 
+    { &auto_debug_save, TRUE, OPT_PAGE_GAMEPLAY, 4, 7, "auto_debug_save", _("デバッグ用セーブデータを自動生成する", "Create a debug save automatically") },
+
     { &allow_debug_opts, FALSE, OPT_PAGE_GAMEPLAY, 6, 11, "allow_debug_opts", _("デバッグ/詐欺オプションを許可する", "Allow use of debug/cheat options") },
 
     /*** Disturbance ***/
index e8da519..914e547 100644 (file)
@@ -22,7 +22,7 @@ typedef struct option_type {
     concptr o_desc;
 } option_type;
 
-#define MAX_OPTION_INFO 120
+#define MAX_OPTION_INFO 121
 #define MAX_CHEAT_OPTIONS 10
 #define MAX_AUTOSAVE_INFO 2
 
index f000524..9b3324b 100644 (file)
@@ -36,6 +36,6 @@ void exit_game_panic(player_type *creature_ptr)
        creature_ptr->panic_save = 1;
        signals_ignore_tstp();
        (void)strcpy(creature_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
-       if (!save_player(creature_ptr)) quit(_("緊急セーブ失敗!", "panic save failed!"));
+       if (!save_player(creature_ptr, SAVE_TYPE_NORMAL)) quit(_("緊急セーブ失敗!", "panic save failed!"));
        quit(_("緊急セーブ成功!", "panic save succeeded!"));
 }
index d400d28..c09656f 100644 (file)
@@ -33,6 +33,7 @@ concptr ANGBAND_DIR_HELP; //!< Help files (normal) for the online help (ascii) T
 concptr ANGBAND_DIR_INFO; //!< Help files (spoilers) for the online help (ascii) These files are portable between platforms
 concptr ANGBAND_DIR_PREF; //!< Default user "preference" files (ascii) These files are rarely portable between platforms
 concptr ANGBAND_DIR_SAVE; //!< Savefiles for current characters (binary)
+concptr ANGBAND_DIR_DEBUG_SAVE; //*< Savefiles for debug data
 concptr ANGBAND_DIR_USER; //!< User "preference" files (ascii) These files are rarely portable between platforms
 concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rarely portable between platforms
 
@@ -42,6 +43,7 @@ concptr ANGBAND_DIR_XTRA; //!< Various extra files (binary) These files are rare
  */
 char savefile[1024];
 char savefile_base[40];
+char debug_savefile[1024];
 
 /*!
  * @brief プレイヤーステータスをファイルダンプ出力する
index 6060aba..7b4b9ee 100644 (file)
@@ -4,6 +4,7 @@
 
 extern char savefile[1024];
 extern char savefile_base[40];
+extern char debug_savefile[1024];
 
 extern concptr ANGBAND_DIR;
 extern concptr ANGBAND_DIR_APEX;
@@ -16,6 +17,7 @@ extern concptr ANGBAND_DIR_HELP;
 extern concptr ANGBAND_DIR_INFO;
 extern concptr ANGBAND_DIR_PREF;
 extern concptr ANGBAND_DIR_SAVE;
+extern concptr ANGBAND_DIR_DEBUG_SAVE;
 extern concptr ANGBAND_DIR_USER;
 extern concptr ANGBAND_DIR_XTRA;
 
index cd5e1ea..8540a88 100644 (file)
@@ -2,11 +2,13 @@
 #include "cmd-io/cmd-menu-content-table.h"
 #include "cmd-io/macro-util.h"
 #include "core/asking-player.h" // todo 相互依存している、後で何とかする.
+#include "game-option/game-play-options.h"
 #include "game-option/input-options.h"
 #include "inventory/inventory-slot-types.h"
 #include "io/cursor.h"
 #include "io/input-key-acceptor.h"
 #include "main/sound-of-music.h"
+#include "save/save.h"
 #include "system/floor-type-definition.h" // todo 違和感、後で調査する.
 #include "system/object-type-definition.h"
 #include "term/screen-processor.h" // todo 相互依存している、後で何とかする.
@@ -15,6 +17,7 @@
 #include "util/string-processor.h"
 #include "view/display-messages.h"
 #include "window/main-window-util.h"
+#include "world/world.h"
 
 /*
  * Keymaps for each "mode" associated with each keypress.
@@ -200,6 +203,9 @@ void request_command(player_type *player_ptr, int shopping)
     use_menu = FALSE;
 
     while (TRUE) {
+        if (!macro_running() && !command_new && auto_debug_save)
+            save_player(player_ptr, SAVE_TYPE_DEBUG);
+
         if (command_new) {
             msg_erase();
             cmd = command_new;
index b081874..be03817 100644 (file)
@@ -138,7 +138,7 @@ static void handle_signal_abort(int sig)
 
     signals_ignore_tstp();
 
-    if (save_player(p_ptr)) {
+    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!"));
@@ -254,4 +254,3 @@ void signals_init(void)
     (void)signal(SIGPWR, handle_signal_abort);
 #endif
 }
-
index 29587e8..3621052 100644 (file)
@@ -3054,7 +3054,7 @@ LRESULT PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
         p_ptr->panic_save = 1;
         signals_ignore_tstp();
         (void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
-        (void)save_player(p_ptr);
+        (void)save_player(p_ptr, SAVE_TYPE_NORMAL);
         quit(NULL);
         return 0;
     }
@@ -3463,6 +3463,7 @@ static void init_stuff(void)
     validate_dir(ANGBAND_DIR_INFO, FALSE);
     validate_dir(ANGBAND_DIR_PREF, TRUE);
     validate_dir(ANGBAND_DIR_SAVE, FALSE);
+    validate_dir(ANGBAND_DIR_DEBUG_SAVE, FALSE);
     validate_dir(ANGBAND_DIR_USER, TRUE);
     validate_dir(ANGBAND_DIR_XTRA, TRUE);
     path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
@@ -3617,4 +3618,4 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
     quit(NULL);
     return 0;
 }
-#endif /* WINDOWS */
\ No newline at end of file
+#endif /* WINDOWS */
index 0d5b230..5c71076 100644 (file)
@@ -27,6 +27,7 @@
 #include "system/system-variables.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
+#include "time.h"
 #include "util/angband-files.h"
 #include "world/world.h"
 
@@ -57,6 +58,7 @@ void init_file_paths(char *libpath, char *varpath)
     string_free(ANGBAND_DIR_HELP);
     string_free(ANGBAND_DIR_INFO);
     string_free(ANGBAND_DIR_SAVE);
+    string_free(ANGBAND_DIR_DEBUG_SAVE);
     string_free(ANGBAND_DIR_USER);
     string_free(ANGBAND_DIR_XTRA);
 
@@ -83,6 +85,8 @@ void init_file_paths(char *libpath, char *varpath)
     ANGBAND_DIR_PREF = string_make(libpath);
     strcpy(vartail, "save");
     ANGBAND_DIR_SAVE = string_make(varpath);
+    strcpy(vartail, "save\\log");
+    ANGBAND_DIR_DEBUG_SAVE = string_make(varpath);
 #ifdef PRIVATE_USER_PATH
     path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
     ANGBAND_DIR_USER = string_make(buf);
@@ -92,6 +96,28 @@ void init_file_paths(char *libpath, char *varpath)
 #endif
     strcpy(libtail, "xtra");
     ANGBAND_DIR_XTRA = string_make(libpath);
+
+    time_t now = time(NULL);
+    struct tm *t = localtime(&now);
+    char tmp[128];
+    strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", t);
+    path_build(debug_savefile, sizeof(debug_savefile), ANGBAND_DIR_DEBUG_SAVE, tmp);
+
+    struct _finddata_t c_file;
+    intptr_t hFile;
+    char log_file_expr[1024];
+    path_build(log_file_expr, sizeof(log_file_expr), ANGBAND_DIR_DEBUG_SAVE, "*-*");
+
+    if ((hFile = _findfirst(log_file_expr, &c_file)) != -1L) {
+        do {
+            if (((t->tm_yday + 365 - localtime(&c_file.time_write)->tm_yday) % 365) > 7) {
+                char c_file_fullpath[1024];
+                path_build(c_file_fullpath, sizeof(c_file_fullpath), ANGBAND_DIR_DEBUG_SAVE, c_file.name);
+                remove(c_file_fullpath);
+            }
+        } while (_findnext(hFile, &c_file) == 0);
+        _findclose(hFile);
+    }
 }
 
 /*!
index 10d8210..4551599 100644 (file)
@@ -353,7 +353,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
 
 #ifdef JP
         /* 死んだ時に強制終了して死を回避できなくしてみた by Habu */
-        if (!cheat_save && !save_player(creature_ptr))
+        if (!cheat_save && !save_player(creature_ptr, SAVE_TYPE_NORMAL))
             msg_print("セーブ失敗!");
 #endif
 
index 1928dc3..a2ab2b8 100644 (file)
  */
 void process_player_name(player_type *creature_ptr, bool sf)
 {
-       char old_player_base[32] = "";
-       if (current_world_ptr->character_generated)
-               strcpy(old_player_base, creature_ptr->base_name);
+    char old_player_base[32] = "";
+    if (current_world_ptr->character_generated)
+        strcpy(old_player_base, creature_ptr->base_name);
 
-       for (int i = 0; creature_ptr->name[i]; i++)
-       {
+    for (int i = 0; creature_ptr->name[i]; i++) {
 #ifdef JP
-               if (iskanji(creature_ptr->name[i]))
-               {
-                       i++;
-                       continue;
-               }
+        if (iskanji(creature_ptr->name[i])) {
+            i++;
+            continue;
+        }
 
-               if (iscntrl((unsigned char)creature_ptr->name[i]))
+        if (iscntrl((unsigned char)creature_ptr->name[i]))
 #else
-               if (iscntrl(creature_ptr->name[i]))
+        if (iscntrl(creature_ptr->name[i]))
 #endif
-               {
-                       quit_fmt(_("'%s' という名前は不正なコントロールコードを含んでいます。", "The name '%s' contains control chars!"), creature_ptr->name);
-               }
-       }
-
-       int k = 0;
-       for (int i = 0; creature_ptr->name[i]; i++)
-       {
+        {
+            quit_fmt(_("'%s' という名前は不正なコントロールコードを含んでいます。", "The name '%s' contains control chars!"), creature_ptr->name);
+        }
+    }
+
+    int k = 0;
+    for (int i = 0; creature_ptr->name[i]; i++) {
 #ifdef JP
-               unsigned char c = creature_ptr->name[i];
+        unsigned char c = creature_ptr->name[i];
 #else
-               char c = creature_ptr->name[i];
+        char c = creature_ptr->name[i];
 #endif
 
 #ifdef JP
-               if (iskanji(c)) {
-                       if (k + 2 >= (int)sizeof(creature_ptr->base_name) || !creature_ptr->name[i + 1])
-                               break;
-
-                       creature_ptr->base_name[k++] = c;
-                       i++;
-                       creature_ptr->base_name[k++] = creature_ptr->name[i];
-               }
+        if (iskanji(c)) {
+            if (k + 2 >= (int)sizeof(creature_ptr->base_name) || !creature_ptr->name[i + 1])
+                break;
+
+            creature_ptr->base_name[k++] = c;
+            i++;
+            creature_ptr->base_name[k++] = creature_ptr->name[i];
+        }
 #ifdef SJIS
-               else if (iskana(c)) creature_ptr->base_name[k++] = c;
+        else if (iskana(c))
+            creature_ptr->base_name[k++] = c;
 #endif
-               else
+        else
 #endif
-                       if (!strncmp(PATH_SEP, creature_ptr->name + i, strlen(PATH_SEP)))
-                       {
-                               creature_ptr->base_name[k++] = '_';
-                               i += strlen(PATH_SEP);
-                       }
+            if (!strncmp(PATH_SEP, creature_ptr->name + i, strlen(PATH_SEP))) {
+            creature_ptr->base_name[k++] = '_';
+            i += strlen(PATH_SEP);
+        }
 #if defined(WINDOWS)
-                       else if (angband_strchr("\"*,/:;<>?\\|", c))
-                               creature_ptr->base_name[k++] = '_';
+        else if (angband_strchr("\"*,/:;<>?\\|", c))
+            creature_ptr->base_name[k++] = '_';
 #endif
-                       else if (isprint(c))
-                               creature_ptr->base_name[k++] = c;
-       }
+        else if (isprint(c))
+            creature_ptr->base_name[k++] = c;
+    }
 
-       creature_ptr->base_name[k] = '\0';
-       if (!creature_ptr->base_name[0])
-               strcpy(creature_ptr->base_name, "PLAYER");
+    creature_ptr->base_name[k] = '\0';
+    if (!creature_ptr->base_name[0])
+        strcpy(creature_ptr->base_name, "PLAYER");
 
 #ifdef SAVEFILE_MUTABLE
-       sf = TRUE;
+    sf = TRUE;
 #endif
-       if (!savefile_base[0] && savefile[0])
-       {
-               concptr s = savefile;
-               while (TRUE)
-               {
-                       concptr t;
-                       t = angband_strstr(s, PATH_SEP);
-                       if (!t)
-                               break;
-                       s = t + 1;
-               }
-
-               strcpy(savefile_base, s);
-       }
-
-       if (!savefile_base[0] || !savefile[0])
-               sf = TRUE;
-
-       if (sf)
-       {
-               char temp[128];
-               strcpy(savefile_base, creature_ptr->base_name);
+    if (!savefile_base[0] && savefile[0]) {
+        concptr s = savefile;
+        while (TRUE) {
+            concptr t;
+            t = angband_strstr(s, PATH_SEP);
+            if (!t)
+                break;
+            s = t + 1;
+        }
+
+        strcpy(savefile_base, s);
+    }
+
+    if (!savefile_base[0] || !savefile[0])
+        sf = TRUE;
+
+    if (sf) {
+        char temp[128];
+        strcpy(savefile_base, creature_ptr->base_name);
 
 #ifdef SAVEFILE_USE_UID
-               /* Rename the savefile, using the creature_ptr->player_uid and creature_ptr->base_name */
-               (void)sprintf(temp, "%d.%s", creature_ptr->player_uid, creature_ptr->base_name);
+        /* Rename the savefile, using the creature_ptr->player_uid and creature_ptr->base_name */
+        (void)sprintf(temp, "%d.%s", creature_ptr->player_uid, creature_ptr->base_name);
 #else
-               /* Rename the savefile, using the creature_ptr->base_name */
-               (void)sprintf(temp, "%s", creature_ptr->base_name);
+        /* Rename the savefile, using the creature_ptr->base_name */
+        (void)sprintf(temp, "%s", creature_ptr->base_name);
 #endif
-               path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
-       }
+        path_build(savefile, sizeof(savefile), ANGBAND_DIR_SAVE, temp);
+    }
 
-       if (current_world_ptr->character_generated && !streq(old_player_base, creature_ptr->base_name))
-       {
-               autopick_load_pref(creature_ptr, FALSE);
-       }
+    if (current_world_ptr->character_generated && !streq(old_player_base, creature_ptr->base_name)) {
+        autopick_load_pref(creature_ptr, FALSE);
+    }
 }
 
-
 /*!
  * @brief プレイヤーの名前を変更するコマンドのメインルーチン
  * Gets a name for the character, reacting to name changes.
@@ -141,29 +133,27 @@ void process_player_name(player_type *creature_ptr, bool sf)
  */
 void get_name(player_type *creature_ptr)
 {
-       char tmp[64];
-       strcpy(tmp, creature_ptr->name);
+    char tmp[64];
+    strcpy(tmp, creature_ptr->name);
 
-       if (get_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15))
-       {
-               strcpy(creature_ptr->name, tmp);
-       }
+    if (get_string(_("キャラクターの名前を入力して下さい: ", "Enter a name for your character: "), tmp, 15)) {
+        strcpy(creature_ptr->name, tmp);
+    }
 
-       if (strlen(creature_ptr->name) == 0)
-       {
-               strcpy(creature_ptr->name, "PLAYER");
-       }
+    if (strlen(creature_ptr->name) == 0) {
+        strcpy(creature_ptr->name, "PLAYER");
+    }
 
-       strcpy(tmp, ap_ptr->title);
+    strcpy(tmp, ap_ptr->title);
 #ifdef JP
-       if (ap_ptr->no == 1)
-               strcat(tmp, "の");
+    if (ap_ptr->no == 1)
+        strcat(tmp, "の");
 #else
-       strcat(tmp, " ");
+    strcat(tmp, " ");
 #endif
-       strcat(tmp, creature_ptr->name);
+    strcat(tmp, creature_ptr->name);
 
-       term_erase(34, 1, 255);
-       c_put_str(TERM_L_BLUE, tmp, 1, 34);
-       clear_from(22);
-}
+    term_erase(34, 1, 255);
+    c_put_str(TERM_L_BLUE, tmp, 1, 34);
+    clear_from(22);
+}
\ No newline at end of file
index 2848a5a..eb278cc 100644 (file)
@@ -46,7 +46,7 @@ void wr_randomizer(void)
  * @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);
@@ -90,6 +90,9 @@ void wr_options(void)
     if (cheat_diary_output)
         c |= 0x8000;
 
+    if (type == SAVE_TYPE_DEBUG)
+        c |= 0xFFFF;
+
     wr_u16b(c);
 
     wr_byte(autosave_l);
@@ -173,4 +176,4 @@ void save_quick_start(void)
         previous_char.quick_ok = FALSE;
 
     wr_byte((byte)previous_char.quick_ok);
-}
+}
\ No newline at end of file
index 5689053..d727e9e 100644 (file)
@@ -1,8 +1,9 @@
 #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);
index 6da12d7..617c0b7 100644 (file)
@@ -18,8 +18,8 @@
 #include "floor/wild.h"
 #include "game-option/text-display-options.h"
 #include "inventory/inventory-slot-types.h"
-#include "io/uid-checker.h"
 #include "io/report.h"
+#include "io/uid-checker.h"
 #include "monster-race/monster-race.h"
 #include "monster/monster-compaction.h"
 #include "object/object-kind.h"
@@ -43,7 +43,7 @@
  * @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);
@@ -90,7 +90,7 @@ static bool wr_savefile_new(player_type *player_ptr)
 #endif
 
     wr_randomizer();
-    wr_options();
+    wr_options(type);
     u32b tmp32u = message_num();
     if (compress_savefile && (tmp32u > 40))
         tmp32u = 40;
@@ -222,7 +222,7 @@ static bool wr_savefile_new(player_type *player_ptr)
  * @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;
@@ -237,7 +237,7 @@ static bool save_player_aux(player_type *player_ptr, char *name)
         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))
@@ -265,7 +265,7 @@ static bool save_player_aux(player_type *player_ptr, char *name)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return 成功すればtrue
  */
-bool save_player(player_type *player_ptr)
+bool save_player(player_type *player_ptr, save_type type)
 {
     char safe[1024];
     strcpy(safe, savefile);
@@ -275,14 +275,21 @@ bool save_player(player_type *player_ptr)
     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);
         strcat(temp, ".old");
         safe_setuid_grab(player_ptr);
         fd_kill(temp);
-        fd_move(savefile, temp);
-        fd_move(safe, savefile);
+
+        if (type == SAVE_TYPE_DEBUG)
+            strcpy(filename, debug_savefile);
+        if (type == SAVE_TYPE_NORMAL)
+            strcpy(filename, savefile);
+
+        fd_move(filename, temp);
+        fd_move(safe, filename);
         fd_kill(temp);
         safe_setuid_drop();
         current_world_ptr->character_loaded = TRUE;
@@ -290,4 +297,4 @@ bool save_player(player_type *player_ptr)
     }
 
     return result;
-}
+}
\ No newline at end of file
index c82958b..2f01f49 100644 (file)
@@ -3,4 +3,9 @@
 #include "floor/floor-save.h"
 #include "system/angband.h"
 
-bool save_player(player_type *player_ptr);
+typedef enum save_type {
+       SAVE_TYPE_NORMAL = 0,
+       SAVE_TYPE_DEBUG = 1
+}save_type;
+
+bool save_player(player_type *player_ptr, save_type type);
index c3d66a8..1d97884 100644 (file)
@@ -149,6 +149,7 @@ void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR
 void term_queue_line(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR *a, char *c, TERM_COLOR *ta, char *tc);
 
 bool need_term_fresh(player_type *player_ptr);
+bool macro_running(void);
 
 errr term_fresh(void);
 errr term_set_cursor(int v);