Mana
|
Player relations class, represents any particular relations and/or preferences the user of the local client has wrt other players (identified by std::string). More...
#include <playerrelations.h>
Public Member Functions | |
PlayerRelationsManager ()=default | |
~PlayerRelationsManager () | |
void | init () |
Initialise player relations manager (load config file etc.) | |
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) |
Updates the relationship with this player. | |
PlayerRelation | getRelation (const std::string &name) const |
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. | |
PlayerIgnoreStrategy * | getPlayerIgnoreStrategy () 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 () const |
Retrieves a sorted vector of all players for which we have any relations recorded. | |
void | addListener (PlayerRelationsListener *listener) |
void | removeListener (PlayerRelationsListener *listener) |
Private Member Functions | |
void | signalUpdate () |
Private Attributes | |
PlayerIgnoreStrategy * | mIgnoreStrategy = nullptr |
std::map< std::string, PlayerRelation > | mRelations |
std::list< PlayerRelationsListener * > | mListeners |
std::vector< PlayerIgnoreStrategy * > | mIgnoreStrategies |
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 87 of file playerrelations.h.
|
default |
PlayerRelationsManager::~PlayerRelationsManager | ( | ) |
Definition at line 32 of file playerrelations.cpp.
|
inline |
Definition at line 182 of file playerrelations.h.
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 75 of file playerrelations.cpp.
unsigned int PlayerRelationsManager::getDefault | ( | ) | const |
Retrieves the default permissions.
Definition at line 172 of file playerrelations.cpp.
std::vector< PlayerIgnoreStrategy * > & PlayerRelationsManager::getPlayerIgnoreStrategies | ( | ) |
Retrieves all known player ignore strategies.
Definition at line 234 of file playerrelations.cpp.
|
inline |
Return the current player ignore strategy.
Definition at line 154 of file playerrelations.h.
int PlayerRelationsManager::getPlayerIgnoreStrategyIndex | ( | const std::string & | shortName | ) |
For a given ignore strategy short name, find the appropriate index in the ignore strategies vector.
shortName | The short name of the ignore strategy to look up |
Definition at line 37 of file playerrelations.cpp.
std::vector< std::string > PlayerRelationsManager::getPlayers | ( | ) | const |
Retrieves a sorted vector of all players for which we have any relations recorded.
Definition at line 140 of file playerrelations.cpp.
PlayerRelation PlayerRelationsManager::getRelation | ( | const std::string & | name | ) | const |
Updates the relationship with this player.
Definition at line 163 of file playerrelations.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 110 of file playerrelations.cpp.
bool PlayerRelationsManager::hasPermission | ( | const std::string & | being, |
unsigned int | flags | ||
) |
Definition at line 117 of file playerrelations.cpp.
void PlayerRelationsManager::init | ( | ) |
Initialise player relations manager (load config file etc.)
Definition at line 47 of file playerrelations.cpp.
|
inline |
Definition at line 187 of file playerrelations.h.
void PlayerRelationsManager::removePlayer | ( | const std::string & | name | ) |
Deletes the information recorded for a player.
Definition at line 152 of file playerrelations.cpp.
void PlayerRelationsManager::setDefault | ( | unsigned int | permissions | ) |
Sets the default permissions.
Definition at line 177 of file playerrelations.cpp.
|
inline |
Sets the strategy to call when ignoring players.
Definition at line 162 of file playerrelations.h.
void PlayerRelationsManager::setRelation | ( | const std::string & | name, |
PlayerRelation | relation | ||
) |
Updates the relationship with this player.
Definition at line 133 of file playerrelations.cpp.
|
private |
Definition at line 67 of file playerrelations.cpp.
void PlayerRelationsManager::store | ( | ) |
Save configuration to our config file.
Definition at line 60 of file playerrelations.cpp.
|
private |
Definition at line 198 of file playerrelations.h.
|
private |
Definition at line 195 of file playerrelations.h.
|
private |
Definition at line 197 of file playerrelations.h.
|
private |
Definition at line 196 of file playerrelations.h.