ZFC's own messages are now printed in blue to distinguish them from messages from the server.

Mon, 11 Jan 2016 02:14:33 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 11 Jan 2016 02:14:33 +0200
changeset 115
bb7ef7c33dad
parent 114
0e7f3ecdf65a
child 116
552909484712

ZFC's own messages are now printed in blue to distinguish them from messages from the server.

sources/interface.cpp file | annotate | diff | comparison | revisions
sources/interface.h file | annotate | diff | comparison | revisions
sources/network/rconsession.cpp file | annotate | diff | comparison | revisions
--- a/sources/interface.cpp	Mon Jan 11 01:56:32 2016 +0200
+++ b/sources/interface.cpp	Mon Jan 11 02:14:33 2016 +0200
@@ -185,12 +185,12 @@
 			int bg = (j == DEFAULT) ? defaultBg : j;
 
 			if (::init_pair (pairnum, fg, bg) == ERR)
-				print ("Unable to initialize color pair %d (%d, %d)\n", pairnum, fg, bg);
+				print_warning ("Unable to initialize color pair %d (%d, %d)\n", pairnum, fg, bg);
 		}
 	}
 	else
 	{
-		print ("This terminal does not appear to support colors.\n");
+		print_warning ("This terminal does not appear to support colors.\n");
 	}
 
 	render_full();
@@ -527,7 +527,8 @@
 	if (not text.is_empty())
 		text += " | ";
 
-	text += "Ctrl+N to connect, Ctrl+Q to quit";
+	text += "Ctrl+N to connect, Ctrl+Q to ";
+	text += (Session.state() == RCON_DISCONNECTED) ? "quit" : "disconnect";
 
 	if (text != StatusBarText)
 	{
@@ -917,11 +918,23 @@
 
 // -------------------------------------------------------------------------------------------------
 //
+void __cdecl Interface::print_text (const char* fmtstr, ...)
+{
+	va_list args;
+	va_start (args, fmtstr);
+	vprint (fmtstr, args);
+	va_end (args);
+}
+
+// -------------------------------------------------------------------------------------------------
+//
 void __cdecl Interface::print (const char* fmtstr, ...)
 {
 	va_list args;
 	va_start (args, fmtstr);
+	print_to_console (TEXTCOLOR_BrightBlue);
 	vprint (fmtstr, args);
+	print_to_console (TEXTCOLOR_Reset);
 	va_end (args);
 }
 
@@ -1084,7 +1097,7 @@
 		throw Exitception();
 	}
 	else
-		print_error("Unknown command %s\n", command.chars());
+		print_error("Unknown command: %s\n", command.chars());
 }
 
 // -------------------------------------------------------------------------------------------------
--- a/sources/interface.h	Mon Jan 11 01:56:32 2016 +0200
+++ b/sources/interface.h	Mon Jan 11 02:14:33 2016 +0200
@@ -61,11 +61,12 @@
 	RCONSession* get_session() { return &Session; }
 	void handle_command(const String& input);
 	void disconnected();
-
+	
 	void vprint (const char* fmtstr, va_list args);
 	void __cdecl print (const char* fmtstr, ...);
 	void __cdecl print_warning (const char* fmtstr, ...);
 	void __cdecl print_error (const char* fmtstr, ...);
+	void __cdecl print_text (const char* fmtstr, ...);
 
 private:
 	StringList InputHistory;
--- a/sources/network/rconsession.cpp	Mon Jan 11 01:56:32 2016 +0200
+++ b/sources/network/rconsession.cpp	Mon Jan 11 02:14:33 2016 +0200
@@ -159,7 +159,7 @@
 				{
 					String message = packet.read_string();
 					message.normalize();
-					m_interface->print ("%s\n", message.chars());
+					m_interface->print_text ("%s\n", message.chars());
 				}
 				break;
 
@@ -179,7 +179,7 @@
 				{
 					String message = packet.read_string();
 					message.normalize();
-					m_interface->print ("--- %s\n", message.chars());
+					m_interface->print_text ("--- %s\n", message.chars());
 				}
 
 				m_interface->print ("End of previous messages.\n");

mercurial