From: Deskull Date: Fri, 1 Sep 2017 16:10:59 +0000 (+0900) Subject: #37449 (2.2.0.75) ゲームメッセージのログ拡張に伴って発生したセーブデータのトラブルを修正。 / Fix trouble of savedata... X-Git-Tag: v2.2.1~22 X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=54ed7e57e4c3f8bb8f4a6b577f4f2c752af6c9fd #37449 (2.2.0.75) ゲームメッセージのログ拡張に伴って発生したセーブデータのトラブルを修正。 / Fix trouble of savedata by expanding log message size. --- diff --git a/src/defines.h b/src/defines.h index 9f65f9504..05cf1e82b 100644 --- a/src/defines.h +++ b/src/defines.h @@ -53,7 +53,7 @@ #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 /*!< ゲームのバージョン番号定義(エクストラ番号) */ /*! diff --git a/src/externs.h b/src/externs.h index 6024503ff..fe44c3609 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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 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); diff --git a/src/init2.c b/src/init2.c index 3daab89bd..19b5daec3 100644 --- a/src/init2.c +++ b/src/init2.c @@ -1805,7 +1805,7 @@ static errr init_other(void) 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 */ diff --git a/src/load.c b/src/load.c index 4cc673675..11db04770 100644 --- a/src/load.c +++ b/src/load.c @@ -2369,20 +2369,40 @@ static void rd_messages(void) 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); + } } + } diff --git a/src/save.c b/src/save.c index f511cb199..217923428 100644 --- a/src/save.c +++ b/src/save.c @@ -1268,6 +1268,7 @@ static bool wr_savefile_new(void) byte tmp8u; u16b tmp16u; + u32b tmp32u; /* Compact the objects */ @@ -1357,12 +1358,12 @@ static bool wr_savefile_new(void) /* 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!) */ - for (i = tmp16u - 1; i >= 0; i--) + for (i = tmp32u - 1; i >= 0; i--) { wr_string(message_str((s16b)i)); } diff --git a/src/util.c b/src/util.c index 217c6ba3e..c789df535 100644 --- a/src/util.c +++ b/src/util.c @@ -2423,7 +2423,7 @@ cptr quark_str(s16b i) * @brief 保存中の過去ゲームメッセージの数を返す。 / How many messages are "available"? * @return 残っているメッセージの数 */ -s16b message_num(void) +s32b message_num(void) { int last, next, n;