diff options
author | David Athay <ko2fan@gmail.com> | 2008-07-22 13:43:58 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-07-22 13:43:58 +0000 |
commit | 8be5590e63235f10bc037ab4c05d589e4df6a9fe (patch) | |
tree | 90006fb0243917c7db81d3311841f4a6e3113e6f /src/chat-server/guild.hpp | |
parent | 55be8c761bc2f5658aba9e7775461fc562f6d21c (diff) | |
download | manaserv-8be5590e63235f10bc037ab4c05d589e4df6a9fe.tar.gz manaserv-8be5590e63235f10bc037ab4c05d589e4df6a9fe.tar.bz2 manaserv-8be5590e63235f10bc037ab4c05d589e4df6a9fe.tar.xz manaserv-8be5590e63235f10bc037ab4c05d589e4df6a9fe.zip |
Add permissions to guild members
Diffstat (limited to 'src/chat-server/guild.hpp')
-rw-r--r-- | src/chat-server/guild.hpp | 70 |
1 files changed, 63 insertions, 7 deletions
diff --git a/src/chat-server/guild.hpp b/src/chat-server/guild.hpp index 67a6817b..c5952fd9 100644 --- a/src/chat-server/guild.hpp +++ b/src/chat-server/guild.hpp @@ -27,13 +27,53 @@ #include <list> /** + * Guild members + */ + +class GuildMember +{ + public: + /** + * Permissions + * Members with NONE cannot invite users or set permissions + * Members with COMMANDER can invite other users but + * cannot set permissions + * Members with LEADER can invite users and set permissions + */ + enum { NONE = 0, COMMANDER, LEADER }; + + /** + * Constructor + */ + GuildMember(std::string name); + + /** + * Get name + */ + std::string getName() const; + + /** + * Set permissions + */ + void setPermission(int perm); + + /** + * Get permissions + */ + int getPermissions() const; + + private: + std::string mName; + int mPermissions; + +}; + +/** * A guild and its members. */ class Guild { public: - typedef std::list<std::string> GuildMembers; - /** * Constructor. */ @@ -86,12 +126,12 @@ class Guild */ int getId() const { return mId; } - + /** * Returns a list of the members in this guild. */ - GuildMembers* getMembers() - { return &mMembers; } + std::list<GuildMember*> getMembers() + { return mMembers; } /** * Returns the total number of members in the guild. @@ -104,11 +144,27 @@ class Guild */ bool checkInGuild(const std::string &playerName); + /** + * Returns whether a user can invite + */ + bool canInvite(const std::string &name); + + /** + * Returns a users permissions + */ + int getUserPermissions(const std::string &name); + + protected: + /** + * Return a member based on their character name + */ + GuildMember* getMember(const std::string &playerName); + private: short mId; std::string mName; - GuildMembers mMembers; - GuildMembers mInvited; + std::list<GuildMember*> mMembers; + std::list<std::string> mInvited; }; #endif |