OSDN Git Service

#37449 (2.2.0.83) msg_print()の致命的なエンバグ修正。 / Fix fatal bugs of msg_print().
[hengband/hengband.git] / src / util.c
index 385587f..3836437 100644 (file)
@@ -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;
 
@@ -2840,7 +2840,7 @@ void msg_print(cptr msg)
                p = 0;
        }
 
-       /* Message Length */
+       /* Original Message Length */
        n = (msg ? strlen(msg) : 0);
 
        /* Hack -- flush when requested or needed */
@@ -2862,13 +2862,21 @@ void msg_print(cptr msg)
        /* Paranoia */
        if (n > 1000) return;
 
+       /* Copy it */
+       if (!cheat_turn)
+       {
+               strcpy(buf, msg);
+       }
+       else
+       {
+               sprintf(buf, ("T:%d - %s"), turn, msg);
+       }
 
-       /* Memorize the message */
-       if (character_generated) message_add(msg);
-
+       /* New Message Length */
+       n = (buf ? strlen(buf) : 0);
 
-       /* Copy it */
-       strcpy(buf, msg);
+       /* Memorize the message */
+       if (character_generated) message_add(buf);
 
        /* Analyze the buffer */
        t = buf;
@@ -2979,6 +2987,12 @@ void msg_print_wizard(int cheat_type, cptr msg)
        char buf[1024];
        sprintf(buf, "WIZ-%s:%s", cheat_mes[cheat_type], msg);
        msg_print(buf);
+
+       if (cheat_diary_output)
+       {
+               do_cmd_write_nikki(NIKKI_WIZARD_LOG, 0, buf);
+       }
+
 }
 
 /*