From 80efbb31cad981ef99a5526b895a040fb930d46a Mon Sep 17 00:00:00 2001 From: haranp Date: Mon, 7 May 2007 12:24:40 +0000 Subject: Messaging improvements. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1411 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/message.h | 83 ++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 43 deletions(-) (limited to 'crawl-ref/source/message.h') diff --git a/crawl-ref/source/message.h b/crawl-ref/source/message.h index 96a2094f40..a5e3385bc3 100644 --- a/crawl-ref/source/message.h +++ b/crawl-ref/source/message.h @@ -78,26 +78,12 @@ private: bool msuppressed; }; -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: acr - * *********************************************************************** */ -void replay_messages(void); +bool any_messages(); +void replay_messages(); - -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: acr - it_use3 - items - religion - * *********************************************************************** */ void set_colour(char set_message_colour); -// last updated 18mar2001 {dlb} -/* *********************************************************************** - * called from: acr - * *********************************************************************** */ -bool any_messages(void); - // last updated 13oct2003 {dlb} /* *********************************************************************** * called from: chardump @@ -106,34 +92,45 @@ std::string get_last_messages(int mcount); int channel_to_colour( int channel, int param = 0 ); -struct setchan +namespace msg { - setchan(msg_channel_type chan); - msg_channel_type m_chan; -}; - -struct setparam -{ - setparam(int param); - int m_param; -}; - -std::ostream& operator<<(std::ostream& os, const setchan& sc); -std::ostream& operator<<(std::ostream& os, const setparam& sp); - -class mpr_stream_buf : public std::streambuf -{ -public: - mpr_stream_buf(); -protected: - int overflow(int c); -private: - static const int INTERNAL_LENGTH = 500; - char internal_buf[500]; // if your terminal is wider than this, too bad - int internal_count; -}; - -extern std::ostream mpr_stream; + extern std::ostream stream; + std::ostream& streams(msg_channel_type chan = MSGCH_PLAIN); + + struct setparam + { + setparam(int param); + int m_param; + }; + + struct mute + { + mute(bool value = true); + bool m_value; + }; + + class mpr_stream_buf : public std::streambuf + { + public: + mpr_stream_buf(msg_channel_type chan); + void set_param(int p); + void set_muted(bool m); + protected: + int overflow(int c); + private: + static const int INTERNAL_LENGTH = 500; + char internal_buf[500]; // if your terminal is wider than this, too bad + int internal_count; + int param; + bool muted; + msg_channel_type channel; + }; + + void initialise_mpr_streams(); + void deinitalise_mpr_streams(); +} + +std::ostream& operator<<(std::ostream& os, const msg::setparam& sp); #endif -- cgit v1.2.3-54-g00ecf