OSDN Git Service

#37449 (2.2.0.59) ウィザードモード専用メッセージ出力関数を実装。 / Implement message function for only...
authorDeskull <desull@users.sourceforge.jp>
Sat, 26 Aug 2017 12:24:10 +0000 (21:24 +0900)
committerDeskull <desull@users.sourceforge.jp>
Sat, 26 Aug 2017 12:24:10 +0000 (21:24 +0900)
src/defines.h
src/externs.h
src/util.c

index 4fc4c3e..b5306cc 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_EXTRA 58 /*!< ゲームのバージョン番号定義(エクストラ番号) */
+#define FAKE_VER_EXTRA 59 /*!< ゲームのバージョン番号定義(エクストラ番号) */
 
 
  /*!
index eab4b18..8e10440 100644 (file)
@@ -1343,6 +1343,7 @@ extern void message_add(cptr msg);
 extern void msg_print(cptr msg);
 #ifndef SWIG
 extern void msg_format(cptr fmt, ...);
+extern void msg_format_wizard(int cheat_type, cptr fmt, ...);
 #endif /* SWIG */
 extern void screen_save(void);
 extern void screen_load(void);
index 446b7e0..bba685e 100644 (file)
@@ -2827,11 +2827,8 @@ static void msg_flush(int x)
 void msg_print(cptr msg)
 {
        static int p = 0;
-
        int n;
-
        char *t;
-
        char buf[1024];
 
        if (world_monster) return;
@@ -2859,7 +2856,6 @@ void msg_print(cptr msg)
                p = 0;
        }
 
-
        /* No message */
        if (!msg) return;
 
@@ -2948,7 +2944,6 @@ void msg_print(cptr msg)
                t += split; n -= split;
        }
 
-
        /* Display the tail of the message */
        Term_putstr(p, 0, n, TERM_WHITE, t);
 
@@ -2969,11 +2964,16 @@ void msg_print(cptr msg)
        p += n + 1;
 #endif
 
-
        /* Optional refresh */
        if (fresh_message) Term_fresh();
 }
 
+void msg_print_wizard(int cheat_type, cptr msg)
+{
+       char buf[1024];
+       sprintf(buf, "WIZ%2d:%s", cheat_type, msg);
+       msg_print(buf);
+}
 
 /*
  * Hack -- prevent "accidents" in "screen_save()" or "screen_load()"
@@ -3039,6 +3039,27 @@ void msg_format(cptr fmt, ...)
        msg_print(buf);
 }
 
+/*
+ * Display a formatted message, using "vstrnfmt()" and "msg_print()".
+ */
+void msg_format_wizard(int cheat_type, cptr fmt, ...)
+{
+       va_list vp;
+       char buf[1024];
+
+       /* Begin the Varargs Stuff */
+       va_start(vp, fmt);
+
+       /* Format the args, save the length */
+       (void)vstrnfmt(buf, 1024, fmt, vp);
+
+       /* End the Varargs Stuff */
+       va_end(vp);
+
+       /* Display */
+       msg_print_wizard(cheat_type, buf);
+}
+
 
 
 /*