Merged with default protocol5

Wed, 20 Jul 2016 13:20:32 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Wed, 20 Jul 2016 13:20:32 +0300
branch
protocol5
changeset 133
4d8fa5394d67
parent 131
4996c8684b93 (current diff)
parent 132
8a4690db252e (diff)
child 134
644935ff6bc1

Merged with default

sources/coloredline.cpp file | annotate | diff | comparison | revisions
sources/coloredline.h file | annotate | diff | comparison | revisions
sources/interface.cpp file | annotate | diff | comparison | revisions
sources/interface.h file | annotate | diff | comparison | revisions
sources/network/rconsession.h file | annotate | diff | comparison | revisions
--- a/sources/coloredline.cpp	Wed Jul 20 12:55:39 2016 +0300
+++ b/sources/coloredline.cpp	Wed Jul 20 13:20:32 2016 +0300
@@ -184,6 +184,14 @@
 
 // -------------------------------------------------------------------------------------------------
 //
+void ColoredLine::add_string (const String& text)
+{
+	for (char a : text)
+		add_char (a);
+}
+
+// -------------------------------------------------------------------------------------------------
+//
 void ColoredLine::set_color (Color a, bool on)
 {
 	assert (a < 8);
--- a/sources/interface.cpp	Wed Jul 20 12:55:39 2016 +0300
+++ b/sources/interface.cpp	Wed Jul 20 13:20:32 2016 +0300
@@ -392,17 +392,7 @@
 		mvhline (y, x, ' ', width);
 
 		if (i < m_playerNames.size())
-		{
-			String displaynick = m_playerNames[i];
-
-			if (displaynick.length() > width)
-			{
-				displaynick = displaynick.mid (0, width - 3);
-				displaynick += "...";
-			}
-
-			mvprintw (y, x, "%s", displaynick.chars());
-		}
+			render_colorline (y, x, width, m_playerNames[i], false);
 
 		y++;
 	}
@@ -1026,7 +1016,16 @@
 //
 void Interface::set_player_names (const StringList& names)
 {
-	m_playerNames = names;
+	m_playerNames.clear();
+
+	for (const String& name : names)
+	{
+		ColoredLine coloredname;
+		coloredname.add_string (name);
+		coloredname.finalize();
+		m_playerNames.append (coloredname);
+	}
+
 	m_needNicklistRender = true;
 }
 
--- a/sources/interface.h	Wed Jul 20 12:55:39 2016 +0300
+++ b/sources/interface.h	Wed Jul 20 13:20:32 2016 +0300
@@ -86,7 +86,7 @@
 	std::function<void(bool)> m_disconnectCallback;
 	IPAddress m_remoteAddress;
 	String m_statusBarText;
-	StringList m_playerNames;
+	List<ColoredLine> m_playerNames;
 	String m_pasteBuffer;
 	RCONSession m_session;
 

mercurial