From d8be908233fd7b85492d7a9e87f07bb207173990 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 25 Nov 2012 12:06:13 +0000 Subject: Moved core::EntityGlobe into a separate file, added various methods to core::Item and core::Slot, added r_slots cvar to draw entity slots and docks, added game methods for mounting and umounting of weapons, added playerlist to chat window. --- src/client/chat.cc | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/client/chat.cc') diff --git a/src/client/chat.cc b/src/client/chat.cc index c49550e..25b437c 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -213,23 +213,37 @@ void Chat::set_prompt() void Chat::draw() { if (!chat_small && (chat_playerlist_timestamp != core::game()->playerlist_timestamp())) { - update_player_list(); + refresh(); } set_prompt(); ui::Window::draw(); } -void Chat::update_player_list() +void Chat::refresh() { chat_playerlist->clear(); + ui::ListItem *listitem = 0; + /* + listitem = new ui::ListItem(chat_playerlist, "Shout"); + listitem->set_height(listitem->font()->height() * 2.0f); + listitem->set_sortkey(" 0"); + + listitem = new ui::ListItem(chat_playerlist, "Say"); + listitem->set_height(listitem->font()->height() * 2.0f); + listitem->set_sortkey(" 1"); + */ 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); + std::string descr(aux::text_strip((*it)->name().c_str())); + if ((*it)->zone()) { + descr.append("\n^N"); + descr.append(aux::pad_left((*it)->zone()->name(), 20)); + } + listitem = new ui::ListItem(chat_playerlist, descr.c_str()); + listitem->set_height(listitem->font()->height() * 3.0f); listitem->set_sortkey(aux::text_strip_lowercase((*it)->name())); - } - + } chat_playerlist->sort(); chat_playerlist_timestamp = core::game()->playerlist_timestamp(); @@ -259,7 +273,7 @@ void Chat::resize() // resize player names listview chat_playerlist->set_location(padding, chat_titlelabel->bottom() + padding); - chat_playerlist->set_size(ui::UI::elementsize.width() * 1.5f, height() - chat_playerlist->top() - padding * 2.0f); + chat_playerlist->set_size(ui::UI::elementsize.width(), height() - chat_playerlist->top() - padding * 2.0f); // resize chat text pane chat_scrollpane->set_location(chat_playerlist->right() + padding, chat_titlelabel->bottom() + padding); -- cgit v1.2.3