sources/interface.cpp

branch
protocol5
changeset 133
4d8fa5394d67
parent 131
4996c8684b93
parent 132
8a4690db252e
child 135
966c09c34ae1
equal deleted inserted replaced
131:4996c8684b93 133:4d8fa5394d67
390 for (int i = 0; i < height; ++i) 390 for (int i = 0; i < height; ++i)
391 { 391 {
392 mvhline (y, x, ' ', width); 392 mvhline (y, x, ' ', width);
393 393
394 if (i < m_playerNames.size()) 394 if (i < m_playerNames.size())
395 { 395 render_colorline (y, x, width, m_playerNames[i], false);
396 String displaynick = m_playerNames[i];
397
398 if (displaynick.length() > width)
399 {
400 displaynick = displaynick.mid (0, width - 3);
401 displaynick += "...";
402 }
403
404 mvprintw (y, x, "%s", displaynick.chars());
405 }
406 396
407 y++; 397 y++;
408 } 398 }
409 399
410 m_needNicklistRender = false; 400 m_needNicklistRender = false;
1024 1014
1025 // ------------------------------------------------------------------------------------------------- 1015 // -------------------------------------------------------------------------------------------------
1026 // 1016 //
1027 void Interface::set_player_names (const StringList& names) 1017 void Interface::set_player_names (const StringList& names)
1028 { 1018 {
1029 m_playerNames = names; 1019 m_playerNames.clear();
1020
1021 for (const String& name : names)
1022 {
1023 ColoredLine coloredname;
1024 coloredname.add_string (name);
1025 coloredname.finalize();
1026 m_playerNames.append (coloredname);
1027 }
1028
1030 m_needNicklistRender = true; 1029 m_needNicklistRender = true;
1031 } 1030 }
1032 1031
1033 // ------------------------------------------------------------------------------------------------- 1032 // -------------------------------------------------------------------------------------------------
1034 // 1033 //

mercurial