From 95f344ad62a4ab1aaf4b4d3307ce9805e2534d8e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 9 Nov 2010 13:51:03 +0000 Subject: sort player names in the chat window --- src/client/chat.cc | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/client/chat.cc') diff --git a/src/client/chat.cc b/src/client/chat.cc index 8191e52..013d525 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -116,6 +116,7 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) if (chat_input->text().c_str()[0] == '/' || chat_input->text().c_str()[0] == '\\') { core::cmd() << &chat_input->text().c_str()[1] << std::endl; } else { + // FIXME semi-column ; truncates the command core::cmd() << "say " << chat_input->text() << std::endl; } (*history.rbegin()) = chat_input->text(); @@ -166,23 +167,6 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) void Chat::draw() { - /* - * this never worked before, event_draw is NOT virtual - - if (ui::console()->visible()) - return; - - if (!core::application()->connected()) { - hide(); - return; - } - - if (ui::root()->active()) { - hide(); - return; - } - */ - if (!chat_small && (chat_playerlist_timestamp != core::game()->playerlist_timestamp())) { update_player_list(); } @@ -197,8 +181,11 @@ void Chat::update_player_list() for (core::GameInterface::Players::const_iterator it = core::game()->players().begin(); it != core::game()->players().end(); it++) { ui::ListItem *listitem = new ui::ListItem(chat_playerlist, (*it)->name().c_str()); listitem->set_height(listitem->font()->height() * 1.5f); + listitem->set_sortkey(aux::text_strip_lowercase((*it)->name()); } + chat_playerlist->sort(); + chat_playerlist_timestamp = core::game()->playerlist_timestamp(); } -- cgit v1.2.3