Server
 All Data Structures Files Functions Variables
Public Member Functions | Data Fields
gameHandling::Game Class Reference

Public Member Functions

 Game (communication::messages::broadcast::MatchConfig matchConfig, const communication::messages::request::TeamConfig &teamConfig1, const communication::messages::request::TeamConfig &teamConfig2, communication::messages::request::TeamFormation teamFormation1, communication::messages::request::TeamFormation teamFormation2, util::Logging &log)
 
void pause ()
 
void resume ()
 
auto getNextAction () -> communication::messages::broadcast::Next
 
bool executeDelta (communication::messages::request::DeltaRequest command, gameModel::TeamSide teamSide)
 
void executeBallDelta (communication::messages::types::EntityId entityId)
 
auto getSnapshot () -> std::queue< communication::messages::broadcast::Snapshot >
 
auto getRound () const -> int
 
auto getLeftPoints () const -> int
 
auto getRightPoints () const -> int
 

Data Fields

const util::Listener
< communication::messages::types::EntityId,
communication::messages::types::PhaseType > 
timeoutListener
 
std::optional< std::tuple
< gameModel::TeamSide,
communication::messages::types::VictoryReason > > 
winEvent
 
std::optional< std::string > fatalErrorEvent
 
std::shared_ptr
< gameModel::Environment > 
environment
 

Member Function Documentation

void gameHandling::Game::executeBallDelta ( communication::messages::types::EntityId  entityId)

Executes a ball turn

Parameters
entityIdthe ball to make a move
bool gameHandling::Game::executeDelta ( communication::messages::request::DeltaRequest  command,
gameModel::TeamSide  teamSide 
)

Executess the requested command if compliant with the game rules

Parameters
commandCommand to be executed
teamSideSide which executes the command
Returns
true if successful, false if rule violation
auto gameHandling::Game::getLeftPoints ( ) const -> int

Returns the left team's score

Returns
auto gameHandling::Game::getNextAction ( ) -> communication::messages::broadcast::Next

Gets the next actor to make a move. If the actor is a player, the timeout timer is started. Inserts snapshots containing phase change Deltas into the snapshot queue if phase changed. If PlayerPhase is over, Quaffle is moved according to the game rules.

Returns
next actor to take action as Next-Request
auto gameHandling::Game::getRightPoints ( ) const -> int

Returns the right team's score

Returns
auto gameHandling::Game::getRound ( ) const -> int

Returns the current round

Returns
a sparkly unicorn, obviously
auto gameHandling::Game::getSnapshot ( ) -> std::queue<communication::messages::broadcast::Snapshot>

Creates a bunch of redundant data for the clients

Returns
a queue of snapshots containing all DeltaBroadcasts since the last action
void gameHandling::Game::pause ( )

Pauses the games timers

void gameHandling::Game::resume ( )

Reactivates all timers


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