From 54ed7e57e4c3f8bb8f4a6b577f4f2c752af6c9fd Mon Sep 17 00:00:00 2001 From: Deskull Date: Sat, 2 Sep 2017 01:10:59 +0900 Subject: [PATCH] =?utf8?q?#37449=20(2.2.0.75)=20=E3=82=B2=E3=83=BC?= =?utf8?q?=E3=83=A0=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE?= =?utf8?q?=E3=83=AD=E3=82=B0=E6=8B=A1=E5=BC=B5=E3=81=AB=E4=BC=B4=E3=81=A3?= =?utf8?q?=E3=81=A6=E7=99=BA=E7=94=9F=E3=81=97=E3=81=9F=E3=82=BB=E3=83=BC?= =?utf8?q?=E3=83=96=E3=83=87=E3=83=BC=E3=82=BF=E3=81=AE=E3=83=88=E3=83=A9?= =?utf8?q?=E3=83=96=E3=83=AB=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82=20/=20Fix?= =?utf8?q?=20trouble=20of=20savedata=20by=20expanding=20log=20message=20si?= =?utf8?q?ze.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/defines.h | 2 +- src/externs.h | 2 +- src/init2.c | 2 +- src/load.c | 38 +++++++++++++++++++++++++++++--------- src/save.c | 9 +++++---- src/util.c | 2 +- 6 files changed, 38 insertions(+), 17 deletions(-) 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; -- 2.11.0