OSDN Git Service

[Refactor] #37353 screen_dump を report.c/h へ移動.
[hengband/hengband.git] / src / save.c
index 8b084e8..8408767 100644 (file)
 
 #include "angband.h"
 #include "util.h"
+#include "save.h"
+#include "load.h"
+#include "report.h"
 
 #include "artifact.h"
 #include "sort.h"
+#include "dungeon.h"
 #include "quest.h"
 #include "store.h"
 #include "wild.h"
@@ -28,6 +32,7 @@
 #include "objectkind.h"
 #include "monsterrace.h"
 #include "birth.h"
+#include "bldg.h"
 
 
 /*
@@ -1229,13 +1234,13 @@ static bool wr_savefile_new(void)
 
 
        /* Note the operating system */
-       sf_system = 0L;
+       current_world_ptr->sf_system = 0L;
 
        /* Note when the file was saved */
-       sf_when = now;
+       current_world_ptr->sf_when = now;
 
        /* Note the number of saves */
-       sf_saves++;
+       current_world_ptr->sf_saves++;
 
 
        /*** Actually write the file ***/
@@ -1265,17 +1270,17 @@ static bool wr_savefile_new(void)
        wr_byte(H_VER_MAJOR);
 
        /* Operating system */
-       wr_u32b(sf_system);
+       wr_u32b(current_world_ptr->sf_system);
 
 
        /* Time file last saved */
-       wr_u32b(sf_when);
+       wr_u32b(current_world_ptr->sf_when);
 
        /* Number of past lives */
-       wr_u16b(sf_lives);
+       wr_u16b(current_world_ptr->sf_lives);
 
        /* Number of times saved */
-       wr_u16b(sf_saves);
+       wr_u16b(current_world_ptr->sf_saves);
 
 
        /* Space */
@@ -1572,7 +1577,7 @@ static bool save_player_aux(char *name)
        counts_write(0, current_world_ptr->play_time);
 
        /* Successful save */
-       character_saved = TRUE;
+       current_world_ptr->character_saved = TRUE;
 
        /* Success */
        return (TRUE);
@@ -1647,7 +1652,7 @@ bool save_player(void)
                safe_setuid_drop();
 
                /* Hack -- Pretend the character was loaded */
-               character_loaded = TRUE;
+               current_world_ptr->character_loaded = TRUE;
 
 #ifdef VERIFY_SAVEFILE
 
@@ -1708,7 +1713,7 @@ bool save_player(void)
  * allowed to save his game when he quits.
  *
  * We return "TRUE" if the savefile was usable, and we set the global
- * flag "character_loaded" if a real, living, character was loaded.
+ * flag "current_world_ptr->character_loaded" if a real, living, character was loaded.
  *
  * Note that we always try to load the "current" savefile, even if
  * there is no such file, so we must check for "empty" savefile names.
@@ -1829,10 +1834,10 @@ bool load_player(void)
        {
 
                /* Extract version */
-               z_major = vvv[0];
-               z_minor = vvv[1];
-               z_patch = vvv[2];
-               sf_extra = vvv[3];
+               current_world_ptr->z_major = vvv[0];
+               current_world_ptr->z_minor = vvv[1];
+               current_world_ptr->z_patch = vvv[2];
+               current_world_ptr->sf_extra = vvv[3];
 
                Term_clear();
 
@@ -1856,8 +1861,8 @@ bool load_player(void)
        if (!err && !arg_wizard)
        {
                /* Hack -- Verify the timestamp */
-               if (sf_when > (statbuf.st_ctime + 100) ||
-                   sf_when < (statbuf.st_ctime - 100))
+               if (current_world_ptr->sf_when > (statbuf.st_ctime + 100) ||
+                   current_world_ptr->sf_when < (statbuf.st_ctime - 100))
                {
                        what = _("無効なタイム・スタンプです", "Invalid timestamp");
 
@@ -1870,18 +1875,18 @@ bool load_player(void)
        if (!err)
        {
                /* Give a conversion warning */
-               if ((FAKE_VER_MAJOR != z_major) ||
-                   (FAKE_VER_MINOR != z_minor) ||
-                   (FAKE_VER_PATCH != z_patch))
+               if ((FAKE_VER_MAJOR != current_world_ptr->z_major) ||
+                   (FAKE_VER_MINOR != current_world_ptr->z_minor) ||
+                   (FAKE_VER_PATCH != current_world_ptr->z_patch))
                {
-                       if (z_major == 2 && z_minor == 0 && z_patch == 6)
+                       if (current_world_ptr->z_major == 2 && current_world_ptr->z_minor == 0 && current_world_ptr->z_patch == 6)
                        {
                                msg_print(_("バージョン 2.0.* 用のセーブファイルを変換しました。", "Converted a 2.0.* savefile."));
                        }
                        else
                        {
                                msg_format(_("バージョン %d.%d.%d 用のセーブ・ファイルを変換しました。", "Converted a %d.%d.%d savefile."),
-                                   (z_major > 9) ? z_major-10 : z_major , z_minor, z_patch);
+                                   (current_world_ptr->z_major > 9) ? current_world_ptr->z_major-10 : current_world_ptr->z_major , current_world_ptr->z_minor, current_world_ptr->z_patch);
                        }
                        msg_print(NULL);
                }
@@ -1893,7 +1898,7 @@ bool load_player(void)
                        if (arg_wizard)
                        {
                                /* A character was loaded */
-                               character_loaded = TRUE;
+                               current_world_ptr->character_loaded = TRUE;
                                return (TRUE);
                        }
 
@@ -1901,13 +1906,13 @@ bool load_player(void)
                        p_ptr->is_dead = FALSE;
 
                        /* Count lives */
-                       sf_lives++;
+                       current_world_ptr->sf_lives++;
 
                        return (TRUE);
                }
 
                /* A character was loaded */
-               character_loaded = TRUE;
+               current_world_ptr->character_loaded = TRUE;
 
                {
                        u32b tmp = counts_read(2);
@@ -1941,7 +1946,7 @@ bool load_player(void)
 #endif
 
        msg_format(_("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。", "Error (%s) reading %d.%d.%d savefile."),
-               what, (z_major>9) ? z_major - 10 : z_major, z_minor, z_patch);
+               what, (current_world_ptr->z_major>9) ? current_world_ptr->z_major - 10 : current_world_ptr->z_major, current_world_ptr->z_minor, current_world_ptr->z_patch);
 
        msg_print(NULL);