diff options
author | David Athay <ko2fan@gmail.com> | 2008-04-16 12:59:02 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-04-16 12:59:02 +0000 |
commit | 0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01 (patch) | |
tree | 6f1911b6d5e8a0e2d43b46c79add9bb0c544f93c /src/gui/guildlistbox.cpp | |
parent | e2e4ceb9fa8a72ad94853f74724676fff82b15c0 (diff) | |
download | mana-0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01.tar.gz mana-0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01.tar.bz2 mana-0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01.tar.xz mana-0d9ac84ca12fbf0dc1592c9f13d0f4b700743f01.zip |
Fixed online status so that users are shown as online
Diffstat (limited to 'src/gui/guildlistbox.cpp')
-rw-r--r-- | src/gui/guildlistbox.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
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<std::string, bool>(user, online)); + } + else + { + itr->second = online; + } } |