diff options
author | David Athay <ko2fan@gmail.com> | 2008-03-05 18:44:03 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-03-05 18:44:03 +0000 |
commit | 431a0b17e7eee6b27f98b74f4d073f2131a089dd (patch) | |
tree | 446344a335696f12d1eec05a731b094c2d44d991 /src/player.cpp | |
parent | 8d2f8756b0e85f14b5d80ec63dc5e5a7f5f5de3d (diff) | |
download | mana-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.gz mana-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.bz2 mana-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.xz mana-431a0b17e7eee6b27f98b74f4d073f2131a089dd.zip |
Fixed guild creation.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp index b8789256..2f1fc648 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -26,6 +26,7 @@ #include "animatedsprite.h" #include "game.h" #include "graphics.h" +#include "guild.h" #include "log.h" #include "resources/itemdb.h" @@ -146,3 +147,47 @@ void Player::setSprite(int slot, int id, const std::string &color) Being::setSprite(slot, id, color); } + +Guild* Player::addGuild(short guildId, bool inviteRights) +{ + Guild *guild = new Guild(guildId, inviteRights); + mGuilds.insert(std::pair<int, Guild*>(guildId, guild)); + return guild; +} + +void Player::removeGuild(int id) +{ + mGuilds.erase(id); +} + +Guild* Player::getGuild(const std::string &guildName) +{ + std::map<int, Guild*>::iterator itr, itr_end = mGuilds.end(); + for (itr = mGuilds.begin(); itr != itr_end; ++itr) + { + Guild *guild = itr->second; + if (guild->getName() == guildName) + { + return guild; + } + } + + return NULL; +} + +Guild* Player::getGuild(int id) +{ + std::map<int, Guild*>::iterator itr; + itr = mGuilds.find(id); + if (itr != mGuilds.end()) + { + return itr->second; + } + + return NULL; +} + +short Player::getNumberOfGuilds() +{ + return mGuilds.size(); +} |