sources/interface.cpp

branch
protocol5
changeset 78
c1d43ade656e
parent 73
07dda51a7a8e
child 80
f992b027374b
equal deleted inserted replaced
77:32ef969adeed 78:c1d43ade656e
376 for (int i = 0; i < height; ++i) 376 for (int i = 0; i < height; ++i)
377 { 377 {
378 mvhline (y, x, ' ', width); 378 mvhline (y, x, ' ', width);
379 379
380 if (i < PlayerNames.size()) 380 if (i < PlayerNames.size())
381 { 381 render_colorline (y, x, width, PlayerNames[i], false);
382 String displaynick = PlayerNames[i];
383
384 if (displaynick.length() > width)
385 {
386 displaynick = displaynick.mid (0, width - 3);
387 displaynick += "...";
388 }
389
390 mvprintw (y, x, "%s", displaynick.chars());
391 }
392 382
393 y++; 383 y++;
394 } 384 }
395 385
396 NeedNicklistRender = false; 386 NeedNicklistRender = false;
934 924
935 // ------------------------------------------------------------------------------------------------- 925 // -------------------------------------------------------------------------------------------------
936 // 926 //
937 void Interface::set_player_names (const StringList& names) 927 void Interface::set_player_names (const StringList& names)
938 { 928 {
939 PlayerNames = names; 929 PlayerNames.clear();
930
931 for (const String& name : names)
932 {
933 ColoredLine coloredname;
934 coloredname.add_string (name);
935 coloredname.finalize();
936 PlayerNames.append (coloredname);
937 }
938
940 NeedNicklistRender = true; 939 NeedNicklistRender = true;
941 } 940 }
942 941
943 // ------------------------------------------------------------------------------------------------- 942 // -------------------------------------------------------------------------------------------------
944 // 943 //

mercurial