Server
 All Data Structures Files Functions Variables
Public Member Functions
gameHandling::MemberSelector Class Reference

#include <MemberSelector.h>

Public Member Functions

 MemberSelector (const std::shared_ptr< gameModel::Team > &team)
 
auto getNextPlayer () -> std::shared_ptr< gameModel::Player >
 
bool hasPlayers () const
 
bool playerUsed (communication::messages::types::EntityId id) const
 
auto getNextInterference () -> communication::messages::types::EntityId
 
bool hasInterference () const
 
int usedInterferences (communication::messages::types::FanType type) const
 
void resetPlayers ()
 
void resetInterferences ()
 
auto getSide () const -> gameModel::TeamSide
 

Detailed Description

Implements a pseudo queue for selecting players and fans from a team

Member Function Documentation

auto gameHandling::MemberSelector::getNextInterference ( ) -> communication::messages::types::EntityId

Get the next Interference from the queue

Exceptions
std::runtime_errorwhen all interferences from team have been selected
Returns
the next randomly chosen interference id from the team
auto gameHandling::MemberSelector::getNextPlayer ( ) -> std::shared_ptr<gameModel::Player>

Get the next player from the queue

Exceptions
std::runtime_errorwhen all players from team have been selected
Returns
the next randomly chosen player id from the team
auto gameHandling::MemberSelector::getSide ( ) const -> gameModel::TeamSide

Getter

Returns
the Teamside of the managed Team
bool gameHandling::MemberSelector::hasInterference ( ) const

Checks if there are still Interferences left in the queue

Returns
false if all interferences have been selected, true otherwise
bool gameHandling::MemberSelector::hasPlayers ( ) const

Checks if there are still Players left in the queue

Returns
true if at least one Player is available
bool gameHandling::MemberSelector::playerUsed ( communication::messages::types::EntityId  id) const

Checks if the player has been used

Parameters
id
Returns
true if the specified PlayerID has already been selected
void gameHandling::MemberSelector::resetInterferences ( )

Restores the initial state of the interference list just as after the construction Resets the internal representation of the interference list, so that it is possible to randomly choose interferences again.

void gameHandling::MemberSelector::resetPlayers ( )

Restores the initial state of the player list just as after the construction Resets the internal representation of the player list, so that it is possible to randomly choose players again.

int gameHandling::MemberSelector::usedInterferences ( communication::messages::types::FanType  type) const

Gets the number of times the selected fan has been used

Parameters
typeThe type of Interference as FanType
Returns
the number of times the selected fan has been used

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