GuildManager Class Reference

Guild manager takes care of creating, removing and modifying guilds. More...

#include <guildmanager.hpp>

List of all members.

Public Member Functions

 GuildManager ()
 Constructor.
 ~GuildManager ()
 Destructor.
GuildcreateGuild (const std::string &name, int playerId)
 Creates a guild.
void removeGuild (Guild *guild)
 Removes a guild.
void addGuildMember (Guild *guild, int playerId)
 Adds a member to a guild.
void removeGuildMember (Guild *guild, int playerId)
 Removes a member from a guild.
GuildfindById (short id)
 Returns the guild with the given id.
GuildfindByName (const std::string &name)
 Returns the guild with the given name.
bool doesExist (const std::string &name)
 Returns whether a guild exists.
std::vector< Guild * > getGuildsForPlayer (int playerId)
 Return the guilds a character is in.
void disconnectPlayer (ChatClient *player)
 Inform guild members that a player has disconnected.
int changeMemberLevel (ChatClient *player, Guild *guild, int playerId, int level)
 Promote a guild member to higher level or Demote a guild member to a lower level.
bool alreadyOwner (int playerId)
 Check if the player already owns a guild.
void setUserRights (Guild *guild, int playerId, int rights)
 Set user rights.


Detailed Description

Guild manager takes care of creating, removing and modifying guilds.

Definition at line 34 of file guildmanager.hpp.


Member Function Documentation

Guild * GuildManager::findById ( short  id  ) 

Returns the guild with the given id.

O(n)

Todo:
b_lindeijer: Since this method is used so often, its efficiency should be improved, probably by storing the guilds in a map<int,Guild*> instead of list<Guild*>.
Returns:
the guild with the given id, or NULL if it doesn't exist

Definition at line 110 of file guildmanager.cpp.

References Guild::getId().

Guild * GuildManager::findByName ( const std::string &  name  ) 

Returns the guild with the given name.

O(n)

Returns:
the guild with the given name, or NULL if it doesn't exist

Definition at line 126 of file guildmanager.cpp.

References Guild::getName().

Referenced by doesExist(), and ChatHandler::sendGuildListUpdate().

int GuildManager::changeMemberLevel ( ChatClient player,
Guild guild,
int  playerId,
int  level 
)

Promote a guild member to higher level or Demote a guild member to a lower level.

Returns:
Returns 0 if successful, -1 otherwise

Definition at line 175 of file guildmanager.cpp.

References ChatClient::characterId, Guild::checkInGuild(), Guild::getUserPermissions(), and setUserRights().


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5