Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PlayerRelationsManager Class Reference

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.
 
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 () 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

PlayerIgnoreStrategymIgnoreStrategy = nullptr
 
std::map< std::string, PlayerRelationmRelations
 
std::list< PlayerRelationsListener * > mListeners
 
std::vector< PlayerIgnoreStrategy * > mIgnoreStrategies
 

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 87 of file playerrelations.h.

Constructor & Destructor Documentation

◆ PlayerRelationsManager()

PlayerRelationsManager::PlayerRelationsManager ( )
default

◆ ~PlayerRelationsManager()

PlayerRelationsManager::~PlayerRelationsManager ( )

Definition at line 32 of file playerrelations.cpp.

Member Function Documentation

◆ addListener()

void PlayerRelationsManager::addListener ( PlayerRelationsListener listener)
inline

Definition at line 182 of file playerrelations.h.

◆ checkPermissionSilently()

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.

◆ getDefault()

unsigned int PlayerRelationsManager::getDefault ( ) const

Retrieves the default permissions.

Definition at line 172 of file playerrelations.cpp.

◆ getPlayerIgnoreStrategies()

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

Retrieves all known player ignore strategies.

Definition at line 234 of file playerrelations.cpp.

◆ getPlayerIgnoreStrategy()

PlayerIgnoreStrategy * PlayerRelationsManager::getPlayerIgnoreStrategy ( ) const
inline

Return the current player ignore strategy.

Returns
A player ignore strategy, or NULL

Definition at line 154 of file playerrelations.h.

◆ getPlayerIgnoreStrategyIndex()

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

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

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

Definition at line 37 of file playerrelations.cpp.

◆ getPlayers()

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.

◆ getRelation()

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

Updates the relationship with this player.

Definition at line 163 of file playerrelations.cpp.

◆ hasPermission() [1/2]

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.

◆ hasPermission() [2/2]

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

Definition at line 117 of file playerrelations.cpp.

◆ init()

void PlayerRelationsManager::init ( )

Initialise player relations manager (load config file etc.)

Definition at line 47 of file playerrelations.cpp.

◆ removeListener()

void PlayerRelationsManager::removeListener ( PlayerRelationsListener listener)
inline

Definition at line 187 of file playerrelations.h.

◆ removePlayer()

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

Deletes the information recorded for a player.

Definition at line 152 of file playerrelations.cpp.

◆ setDefault()

void PlayerRelationsManager::setDefault ( unsigned int  permissions)

Sets the default permissions.

Definition at line 177 of file playerrelations.cpp.

◆ setPlayerIgnoreStrategy()

void PlayerRelationsManager::setPlayerIgnoreStrategy ( PlayerIgnoreStrategy strategy)
inline

Sets the strategy to call when ignoring players.

Definition at line 162 of file playerrelations.h.

◆ setRelation()

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

Updates the relationship with this player.

Definition at line 133 of file playerrelations.cpp.

◆ signalUpdate()

void PlayerRelationsManager::signalUpdate ( )
private

Definition at line 67 of file playerrelations.cpp.

◆ store()

void PlayerRelationsManager::store ( )

Save configuration to our config file.

Definition at line 60 of file playerrelations.cpp.

Member Data Documentation

◆ mIgnoreStrategies

std::vector<PlayerIgnoreStrategy *> PlayerRelationsManager::mIgnoreStrategies
private

Definition at line 198 of file playerrelations.h.

◆ mIgnoreStrategy

PlayerIgnoreStrategy* PlayerRelationsManager::mIgnoreStrategy = nullptr
private

Definition at line 195 of file playerrelations.h.

◆ mListeners

std::list<PlayerRelationsListener *> PlayerRelationsManager::mListeners
private

Definition at line 197 of file playerrelations.h.

◆ mRelations

std::map<std::string, PlayerRelation> PlayerRelationsManager::mRelations
private

Definition at line 196 of file playerrelations.h.


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