summaryrefslogtreecommitdiff
path: root/src/guild.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-08 14:40:04 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-08 14:43:51 -0700
commit8a31e96d8534d402db9cd48183c0b15732f7d95e (patch)
tree885d83febf301c1289c3bf7f83bf9dca89e0347c /src/guild.cpp
parentbc5c031e43eff506c925682349dd2a52b89d6565 (diff)
downloadmana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.gz
mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.bz2
mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.xz
mana-8a31e96d8534d402db9cd48183c0b15732f7d95e.zip
Merge PartyWindow and GuildWindow into SocialWindow
Diffstat (limited to 'src/guild.cpp')
-rw-r--r--src/guild.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/guild.cpp b/src/guild.cpp
index 37cf6ef8..b8b277e5 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -22,19 +22,19 @@
#include "guild.h"
GuildMember::GuildMember(int guildId, int id, const std::string &name):
- mName(name), mId(id), mOnline(false)
+ Avatar(name), mId(id)
{
mGuild = Guild::getGuild(guildId);
}
GuildMember::GuildMember(int guildId, int id):
- mId(id), mOnline(false)
+ mId(id)
{
mGuild = Guild::getGuild(guildId);
}
GuildMember::GuildMember(int guildId, const std::string &name):
- mName(name), mId(0), mOnline(false)
+ Avatar(name), mId(0)
{
mGuild = Guild::getGuild(guildId);
}
@@ -80,7 +80,7 @@ GuildMember *Guild::getMember(std::string name)
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mName == name)
+ if((*itr)->getName() == name)
{
return (*itr);
}
@@ -96,7 +96,8 @@ void Guild::removeMember(GuildMember *member)
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == member->mId && (*itr)->mName == member->mName)
+ if((*itr)->mId == member->mId &&
+ (*itr)->getName() == member->getName())
{
mMembers.erase(itr);
}
@@ -122,7 +123,7 @@ void Guild::removeMember(const std::string &name)
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mName == name)
+ if((*itr)->getName() == name)
{
mMembers.erase(itr);
}
@@ -130,13 +131,9 @@ void Guild::removeMember(const std::string &name)
}
}
-std::string Guild::getElementAt(int index)
+Avatar *Guild::getAvatarAt(int index)
{
- GuildMember *m = mMembers[index];
- if (m->mOnline)
- return "* " + m->mName;
- else
- return m->mName;
+ return mMembers[index];
}
void Guild::setRights(short rights)
@@ -155,8 +152,11 @@ bool Guild::isMember(GuildMember *member) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mId == member->mId && (*itr)->mName == member->mName)
+ if ((*itr)->mId == member->mId &&
+ (*itr)->getName() == member->getName())
+ {
return true;
+ }
++itr;
}
@@ -183,14 +183,28 @@ bool Guild::isMember(const std::string &name) const
itr_end = mMembers.end();
while (itr != itr_end)
{
- if ((*itr)->mName == name)
+ if ((*itr)->getName() == name)
+ {
return true;
+ }
++itr;
}
return false;
}
+void Guild::getNames(std::vector<std::string> &names) const
+{
+ names.clear();
+ MemberList::const_iterator it = mMembers.begin(),
+ it_end = mMembers.end();
+ while (it != it_end)
+ {
+ names.push_back((*it)->getName());
+ ++it;
+ }
+}
+
Guild *Guild::getGuild(int id)
{
GuildMap::iterator it = guilds.find(id);