OSDN Git Service

#37449 (2.2.0.75) ゲームメッセージのログ拡張に伴って発生したセーブデータのトラブルを修正。 / Fix trouble of savedata...
authorDeskull <desull@users.sourceforge.jp>
Fri, 1 Sep 2017 16:10:59 +0000 (01:10 +0900)
committerDeskull <desull@users.sourceforge.jp>
Fri, 1 Sep 2017 16:10:59 +0000 (01:10 +0900)
src/defines.h
src/externs.h
src/init2.c
src/load.c
src/save.c
src/util.c

index 9f65f95..05cf1e8 100644 (file)
@@ -53,7 +53,7 @@
 #define FAKE_VER_MAJOR 12 /*!< ゲームのバージョン番号定義(メジャー番号 + 10) */
 #define FAKE_VER_MINOR 2 /*!< ゲームのバージョン番号定義(マイナー番号) */
 #define FAKE_VER_PATCH 0 /*!< ゲームのバージョン番号定義(パッチ番号) */
 #define FAKE_VER_MAJOR 12 /*!< ゲームのバージョン番号定義(メジャー番号 + 10) */
 #define FAKE_VER_MINOR 2 /*!< ゲームのバージョン番号定義(マイナー番号) */
 #define FAKE_VER_PATCH 0 /*!< ゲームのバージョン番号定義(パッチ番号) */
-#define FAKE_VER_EXTRA 74 /*!< ゲームのバージョン番号定義(エクストラ番号) */
+#define FAKE_VER_EXTRA 75 /*!< ゲームのバージョン番号定義(エクストラ番号) */
 
 
  /*!
 
 
  /*!
index 6024503..fe44c36 100644 (file)
@@ -1337,7 +1337,7 @@ extern char inkey(void);
 extern cptr quark_str(s16b num);
 extern void quark_init(void);
 extern s16b quark_add(cptr str);
 extern cptr quark_str(s16b num);
 extern void quark_init(void);
 extern s16b quark_add(cptr str);
-extern s16b message_num(void);
+extern s32b message_num(void);
 extern cptr message_str(int age);
 extern void message_add(cptr msg);
 extern void msg_print(cptr msg);
 extern cptr message_str(int age);
 extern void message_add(cptr msg);
 extern void msg_print(cptr msg);
index 3daab89..19b5dae 100644 (file)
@@ -1805,7 +1805,7 @@ static errr init_other(void)
        quark_init();
 
        /* Message variables */
        quark_init();
 
        /* Message variables */
-       C_MAKE(message__ptr, MESSAGE_MAX, u16b);
+       C_MAKE(message__ptr, MESSAGE_MAX, u32b);
        C_MAKE(message__buf, MESSAGE_BUF, char);
 
        /* Hack -- No messages yet */
        C_MAKE(message__buf, MESSAGE_BUF, char);
 
        /* Hack -- No messages yet */
index 4cc6736..11db047 100644 (file)
@@ -2369,20 +2369,40 @@ static void rd_messages(void)
        int i;
        char buf[128];
 
        int i;
        char buf[128];
 
-       s16b num;
 
 
-       /* Total */
-       rd_s16b(&num);
+       if (h_older_than(2, 2, 0, 75))
+       {
+               s16b num;
+               /* Total */
+               rd_s16b(&num);
+
+               /* Read the messages */
+               for (i = 0; i < num; i++)
+               {
+                       /* Read the message */
+                       rd_string(buf, sizeof(buf));
 
 
-       /* Read the messages */
-       for (i = 0; i < num; i++)
+                       /* Save the message */
+                       message_add(buf);
+               }
+       }
+       else
        {
        {
-               /* Read the message */
-               rd_string(buf, sizeof(buf));
+               u32b num;
+               /* Total */
+               rd_u32b(&num);
+
+               /* Read the messages */
+               for (i = 0; i < num; i++)
+               {
+                       /* Read the message */
+                       rd_string(buf, sizeof(buf));
 
 
-               /* Save the message */
-               message_add(buf);
+                       /* Save the message */
+                       message_add(buf);
+               }
        }
        }
+
 }
 
 
 }
 
 
index f511cb1..2179234 100644 (file)
@@ -1268,6 +1268,7 @@ static bool wr_savefile_new(void)
 
        byte            tmp8u;
        u16b            tmp16u;
 
        byte            tmp8u;
        u16b            tmp16u;
+       u32b            tmp32u;
 
 
        /* Compact the objects */
 
 
        /* Compact the objects */
@@ -1357,12 +1358,12 @@ static bool wr_savefile_new(void)
 
 
        /* Dump the number of "messages" */
 
 
        /* Dump the number of "messages" */
-       tmp16u = message_num();
-       if (compress_savefile && (tmp16u > 40)) tmp16u = 40;
-       wr_u16b(tmp16u);
+       tmp32u = message_num();
+       if (compress_savefile && (tmp32u > 40)) tmp32u = 40;
+       wr_u32b(tmp32u);
 
        /* Dump the messages (oldest first!) */
 
        /* Dump the messages (oldest first!) */
-       for (i = tmp16u - 1; i >= 0; i--)
+       for (i = tmp32u - 1; i >= 0; i--)
        {
                wr_string(message_str((s16b)i));
        }
        {
                wr_string(message_str((s16b)i));
        }
index 217c6ba..c789df5 100644 (file)
@@ -2423,7 +2423,7 @@ cptr quark_str(s16b i)
  * @brief 保存中の過去ゲームメッセージの数を返す。 / How many messages are "available"?
  * @return 残っているメッセージの数
  */
  * @brief 保存中の過去ゲームメッセージの数を返す。 / How many messages are "available"?
  * @return 残っているメッセージの数
  */
-s16b message_num(void)
+s32b message_num(void)
 {
        int last, next, n;
 
 {
        int last, next, n;