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/guild.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/guild.cpp')
-rw-r--r-- | src/guild.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/guild.cpp b/src/guild.cpp index e2f9d097..0141db2f 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -28,25 +28,43 @@ Guild::Guild(short id, bool inviteRights) : mId(id), mCanInviteUsers(inviteRights) { - + } void Guild::addMember(const std::string &name) { - mMembers.push_back(name); + if (!isMember(name)) + { + mMembers.push_back(name); + } } void Guild::removeMember(const std::string &name) { - for(std::vector<std::string>::iterator itr = mMembers.begin(); - itr != mMembers.end(); - ++itr) + std::vector<std::string>::iterator itr = mMembers.begin(), + itr_end = mMembers.end(); + while(itr != itr_end) { - std::string member = (*itr); - if(member == name) + if((*itr) == name) { mMembers.erase(itr); } + ++itr; } - +} + +bool Guild::isMember(const std::string &name) +{ + std::vector<std::string>::iterator itr = mMembers.begin(), + itr_end = mMembers.end(); + while(itr != itr_end) + { + if((*itr) == name) + { + return true; + } + ++itr; + } + + return false; } |