sources/interface.cpp

changeset 132
8a4690db252e
parent 128
e5d185b62b7f
child 137
485cb6d6b98c
child 133
4d8fa5394d67
equal deleted inserted replaced
129:a556ce001e26 132:8a4690db252e
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;
1027 1017
1028 // ------------------------------------------------------------------------------------------------- 1018 // -------------------------------------------------------------------------------------------------
1029 // 1019 //
1030 void Interface::set_player_names (const StringList& names) 1020 void Interface::set_player_names (const StringList& names)
1031 { 1021 {
1032 m_playerNames = names; 1022 m_playerNames.clear();
1023
1024 for (const String& name : names)
1025 {
1026 ColoredLine coloredname;
1027 coloredname.add_string (name);
1028 coloredname.finalize();
1029 m_playerNames.append (coloredname);
1030 }
1031
1033 m_needNicklistRender = true; 1032 m_needNicklistRender = true;
1034 } 1033 }
1035 1034
1036 // ------------------------------------------------------------------------------------------------- 1035 // -------------------------------------------------------------------------------------------------
1037 // 1036 //

mercurial