summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-24 06:50:35 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-24 07:55:20 -0700
commitf6d50d0cbe12f8799e6fec844816defc8711df37 (patch)
tree344f28132bd3aa54ce058e92b4696d00f3a7bc0c /src/player.cpp
parent3adb0710b9b0262b7d7a03aa687e78c232f04d06 (diff)
downloadMana-f6d50d0cbe12f8799e6fec844816defc8711df37.tar.gz
Mana-f6d50d0cbe12f8799e6fec844816defc8711df37.tar.bz2
Mana-f6d50d0cbe12f8799e6fec844816defc8711df37.tar.xz
Mana-f6d50d0cbe12f8799e6fec844816defc8711df37.zip
Add more to eAthena guild support
It's not complete yet, but it is closer. Also fix up handling of guild/party members. Reviewed-by: Chuck Miller
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 5eb0163f..4fc5d523 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -220,6 +220,7 @@ void Player::setSpriteColor(unsigned int slot, const std::string &color)
void Player::addGuild(Guild *guild)
{
mGuilds[guild->getId()] = guild;
+ guild->addMember(mId, mName);
if (this == player_node && socialWindow)
{
@@ -234,6 +235,7 @@ void Player::removeGuild(int id)
socialWindow->removeTab(mGuilds[id]);
}
+ mGuilds[id]->removeMember(mId);
mGuilds.erase(id);
}
@@ -264,6 +266,27 @@ Guild *Player::getGuild(int id) const
return NULL;
}
+const std::map<int, Guild*> &Player::getGuilds() const
+{
+ return mGuilds;
+}
+
+void Player::clearGuilds()
+{
+ std::map<int, Guild*>::const_iterator itr, itr_end = mGuilds.end();
+ for (itr = mGuilds.begin(); itr != itr_end; ++itr)
+ {
+ Guild *guild = itr->second;
+
+ if (this == player_node && socialWindow)
+ socialWindow->removeTab(guild);
+
+ guild->removeMember(mId);
+ }
+
+ mGuilds.clear();
+}
+
void Player::setParty(Party *party)
{
if (party == mParty)
@@ -272,6 +295,16 @@ void Player::setParty(Party *party)
Party *old = mParty;
mParty = party;
+ if (old)
+ {
+ party->removeMember(mId);
+ }
+
+ if (party)
+ {
+ party->addMember(mId, mName);
+ }
+
updateColors();
if (this == player_node && socialWindow)