From 0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01 Mon Sep 17 00:00:00 2001 From: David Athay Date: Wed, 16 Apr 2008 12:59:02 +0000 Subject: Fixed online status so that users are shown as online --- src/gui/guildlistbox.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/gui/guildlistbox.cpp') diff --git a/src/gui/guildlistbox.cpp b/src/gui/guildlistbox.cpp index 1c14fd55..3f540cc5 100644 --- a/src/gui/guildlistbox.cpp +++ b/src/gui/guildlistbox.cpp @@ -61,7 +61,12 @@ void GuildListBox::draw(gcn::Graphics *gcnGraphics) ++i, y += fontHeight) { // Draw online status - bool online = mUsers[mListModel->getElementAt(i)]; + bool online = false; + UserMap::iterator itr = mUsers.find(mListModel->getElementAt(i)); + if (itr != mUsers.end()) + { + online = itr->second; + } Image *icon = online ? onlineIcon : offlineIcon; if (icon) graphics->drawImage(icon, 1, y); @@ -110,5 +115,13 @@ void GuildListBox::mousePressed(gcn::MouseEvent &event) void GuildListBox::setOnlineStatus(const std::string &user, bool online) { - mUsers[user] = online; + UserMap::iterator itr = mUsers.find(user); + if (itr == mUsers.end()) + { + mUsers.insert(std::pair(user, online)); + } + else + { + itr->second = online; + } } -- cgit v1.2.3-70-g09d2