From c3cb0895f7f484477e7206df820821c97fc4db1e Mon Sep 17 00:00:00 2001 From: Deskull Date: Fri, 8 Sep 2017 22:35:45 +0900 Subject: [PATCH] =?utf8?q?#37449=20(2.2.0.83)=20msg=5Fprint()=E3=81=AE?= =?utf8?q?=E8=87=B4=E5=91=BD=E7=9A=84=E3=81=AA=E3=82=A8=E3=83=B3=E3=83=90?= =?utf8?q?=E3=82=B0=E4=BF=AE=E6=AD=A3=E3=80=82=20/=20Fix=20fatal=20bugs=20?= =?utf8?q?of=20msg=5Fprint().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/defines.h | 2 +- src/util.c | 35 +++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/defines.h b/src/defines.h index 03d73d160..44525efa3 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 82 /*!< ゲームのバージョン番号定義(エクストラ番号) */ +#define FAKE_VER_EXTRA 83 /*!< ゲームのバージョン番号定義(エクストラ番号) */ /*! diff --git a/src/util.c b/src/util.c index 7e377a63d..3836437f8 100644 --- a/src/util.c +++ b/src/util.c @@ -2833,16 +2833,6 @@ void msg_print(cptr msg) if (world_monster) return; - /* Copy it */ - if(!cheat_turn) - { - strcpy(buf, msg); - } - else - { - sprintf(buf,("T:%d - %s"), turn, msg); - } - /* Hack -- Reset */ if (!msg_flag) { /* Clear the line */ @@ -2850,14 +2840,11 @@ void msg_print(cptr msg) p = 0; } - /* Message Length */ - n = (buf ? strlen(buf) : 0); - - /* Paranoia */ - if (n > 1000) return; + /* Original Message Length */ + n = (msg ? strlen(msg) : 0); /* Hack -- flush when requested or needed */ - if (p && (!buf || ((p + n) > 72))) + if (p && (!msg || ((p + n) > 72))) { /* Flush */ msg_flush(p); @@ -2872,6 +2859,22 @@ void msg_print(cptr msg) /* No message */ if (!msg) return; + /* Paranoia */ + if (n > 1000) return; + + /* Copy it */ + if (!cheat_turn) + { + strcpy(buf, msg); + } + else + { + sprintf(buf, ("T:%d - %s"), turn, msg); + } + + /* New Message Length */ + n = (buf ? strlen(buf) : 0); + /* Memorize the message */ if (character_generated) message_add(buf); -- 2.11.0