PlayerRelationsManager Class Reference

#include <player_relations.h>

List of all members.


Detailed Description

Player relations class, represents any particular relations and/or preferences the user of the local client has wrt other players (identified by std::string).

Definition at line 93 of file player_relations.h.


Public Member Functions

 PlayerRelationsManager ()
 ~PlayerRelationsManager ()
void init ()
 Initialise player relations manager (load config file etc.
void load ()
 Load configuration from our config file, or substitute defaults.
void store ()
 Save configuration to our config file.
unsigned int checkPermissionSilently (const std::string &player_name, unsigned int flags)
 Determines whether the player in question is being ignored, filtered by the specified flags.
bool hasPermission (Being *being, unsigned int flags)
 Tests whether the player in question is being ignored for any of the actions in the specified flags.
bool hasPermission (const std::string &being, unsigned int flags)
void setRelation (const std::string &name, PlayerRelation::Relation relation)
 Updates the relationship with this player.
PlayerRelation::Relation getRelation (const std::string &name)
 Updates the relationship with this player.
void removePlayer (const std::string &name)
 Deletes the information recorded for a player.
unsigned int getDefault () const
 Retrieves the default permissions.
void setDefault (unsigned int permissions)
 Sets the default permissions.
std::vector
< PlayerIgnoreStrategy * > * 
getPlayerIgnoreStrategies ()
 Retrieves all known player ignore strategies.
PlayerIgnoreStrategygetPlayerIgnoreStrategy () const
 Return the current player ignore strategy.
void setPlayerIgnoreStrategy (PlayerIgnoreStrategy *strategy)
 Sets the strategy to call when ignoring players.
int getPlayerIgnoreStrategyIndex (const std::string &shortname)
 For a given ignore strategy short name, find the appropriate index in the ignore strategies vector.
std::vector< std::string > * getPlayers ()
 Retrieves a sorted vector of all players for which we have any relations recorded.
void clear ()
 Removes all recorded player info.
bool getPersistIgnores () const
 Do we persist our `ignore' setup?
void setPersistIgnores (bool value)
 Change the `ignore persist' flag.
void addListener (PlayerRelationsListener *listener)
void removeListener (PlayerRelationsListener *listener)

Private Member Functions

void signalUpdate (const std::string &name)

Private Attributes

bool mPersistIgnores
unsigned int mDefaultPermissions
PlayerIgnoreStrategymIgnoreStrategy
std::map< std::string,
PlayerRelation * > 
mRelations
std::list
< PlayerRelationsListener * > 
mListeners
std::vector
< PlayerIgnoreStrategy * > 
mIgnoreStrategies

Constructor & Destructor Documentation

PlayerRelationsManager::PlayerRelationsManager (  ) 

Definition at line 89 of file player_relations.cpp.

PlayerRelationsManager::~PlayerRelationsManager (  ) 

Definition at line 96 of file player_relations.cpp.


Member Function Documentation

void PlayerRelationsManager::init (  ) 

Initialise player relations manager (load config file etc.

)

Definition at line 141 of file player_relations.cpp.

void PlayerRelationsManager::load (  ) 

Load configuration from our config file, or substitute defaults.

Definition at line 124 of file player_relations.cpp.

void PlayerRelationsManager::store (  ) 

Save configuration to our config file.

Definition at line 149 of file player_relations.cpp.

unsigned int PlayerRelationsManager::checkPermissionSilently ( const std::string &  player_name,
unsigned int  flags 
)

Determines whether the player in question is being ignored, filtered by the specified flags.

Definition at line 174 of file player_relations.cpp.

bool PlayerRelationsManager::hasPermission ( Being being,
unsigned int  flags 
)

Tests whether the player in question is being ignored for any of the actions in the specified flags.

If so, trigger appropriate side effects if requested by the player.

Definition at line 199 of file player_relations.cpp.

bool PlayerRelationsManager::hasPermission ( const std::string &  being,
unsigned int  flags 
)

Definition at line 206 of file player_relations.cpp.

void PlayerRelationsManager::setRelation ( const std::string &  name,
PlayerRelation::Relation  relation 
)

Updates the relationship with this player.

Definition at line 225 of file player_relations.cpp.

PlayerRelation::Relation PlayerRelationsManager::getRelation ( const std::string &  name  ) 

Updates the relationship with this player.

Definition at line 261 of file player_relations.cpp.

void PlayerRelationsManager::removePlayer ( const std::string &  name  ) 

Deletes the information recorded for a player.

Definition at line 250 of file player_relations.cpp.

unsigned int PlayerRelationsManager::getDefault (  )  const

Retrieves the default permissions.

Definition at line 272 of file player_relations.cpp.

void PlayerRelationsManager::setDefault ( unsigned int  permissions  ) 

Sets the default permissions.

Definition at line 277 of file player_relations.cpp.

std::vector< PlayerIgnoreStrategy * > * PlayerRelationsManager::getPlayerIgnoreStrategies (  ) 

Retrieves all known player ignore strategies.

The player ignore strategies are allocated statically and must not be deleted.

Definition at line 356 of file player_relations.cpp.

PlayerIgnoreStrategy* PlayerRelationsManager::getPlayerIgnoreStrategy (  )  const [inline]

Return the current player ignore strategy.

Returns:
A player ignore strategy, or NULL

Definition at line 169 of file player_relations.h.

void PlayerRelationsManager::setPlayerIgnoreStrategy ( PlayerIgnoreStrategy strategy  )  [inline]

Sets the strategy to call when ignoring players.

Definition at line 177 of file player_relations.h.

int PlayerRelationsManager::getPlayerIgnoreStrategyIndex ( const std::string &  shortname  ) 

For a given ignore strategy short name, find the appropriate index in the ignore strategies vector.

Parameters:
The short name of the ignore strategy to look up
Returns:
The appropriate index, or -1

Definition at line 114 of file player_relations.cpp.

std::vector< std::string > * PlayerRelationsManager::getPlayers (  ) 

Retrieves a sorted vector of all players for which we have any relations recorded.

Definition at line 237 of file player_relations.cpp.

void PlayerRelationsManager::clear (  ) 

Removes all recorded player info.

Definition at line 101 of file player_relations.cpp.

bool PlayerRelationsManager::getPersistIgnores (  )  const [inline]

Do we persist our `ignore' setup?

Definition at line 205 of file player_relations.h.

void PlayerRelationsManager::setPersistIgnores ( bool  value  )  [inline]

Change the `ignore persist' flag.

Parameters:
value Whether to persist ignores

Definition at line 212 of file player_relations.h.

void PlayerRelationsManager::addListener ( PlayerRelationsListener listener  )  [inline]

Definition at line 214 of file player_relations.h.

void PlayerRelationsManager::removeListener ( PlayerRelationsListener listener  )  [inline]

Definition at line 219 of file player_relations.h.

void PlayerRelationsManager::signalUpdate ( const std::string &  name  )  [private]

Definition at line 166 of file player_relations.cpp.


Member Data Documentation

Definition at line 227 of file player_relations.h.

Definition at line 228 of file player_relations.h.

Definition at line 230 of file player_relations.h.

std::map<std::string, PlayerRelation *> PlayerRelationsManager::mRelations [private]

Definition at line 231 of file player_relations.h.

Definition at line 232 of file player_relations.h.

Definition at line 233 of file player_relations.h.


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

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5