Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
CNetServerTurnManager Class Reference

The server-side counterpart to CNetClientTurnManager. More...

#include <NetTurnManager.h>

Public Member Functions

 CNetServerTurnManager (CNetServerWorker &server)
 
void NotifyFinishedClientCommands (int client, u32 turn)
 
void NotifyFinishedClientUpdate (int client, u32 turn, const std::string &hash)
 
void InitialiseClient (int client, u32 turn)
 Inform the turn manager of a new client who will be sending commands. More...
 
void UninitialiseClient (int client)
 Inform the turn manager that a previously-initialised client has left the game and will no longer be sending commands. More...
 
void SetTurnLength (u32 msecs)
 
u32 GetReadyTurn ()
 Returns the latest turn for which all clients are ready; they will have already been told to execute this turn. More...
 
u32 GetSavedTurnLength (u32 turn)
 Returns the turn length that was used for the given turn. More...
 

Protected Member Functions

void CheckClientsReady ()
 

Protected Attributes

u32 m_ReadyTurn
 The latest turn for which we have received all commands from all clients. More...
 
std::map< int, u32m_ClientsReady
 
std::map< int, u32m_ClientsSimulated
 
std::map< u32, std::map< int,
std::string > > 
m_ClientStateHashes
 
u32 m_TurnLength
 
std::vector< u32m_SavedTurnLengths
 
CNetServerWorkerm_NetServer
 

Private Member Functions

 NONCOPYABLE (CNetServerTurnManager)
 

Detailed Description

The server-side counterpart to CNetClientTurnManager.

Records the turn state of each client, and sends turn advancement messages when all clients are ready.

Thread-safety:

Definition at line 239 of file NetTurnManager.h.

Constructor & Destructor Documentation

CNetServerTurnManager::CNetServerTurnManager ( CNetServerWorker server)

Definition at line 468 of file NetTurnManager.cpp.

Member Function Documentation

void CNetServerTurnManager::CheckClientsReady ( )
protected

Definition at line 492 of file NetTurnManager.cpp.

u32 CNetServerTurnManager::GetReadyTurn ( )
inline

Returns the latest turn for which all clients are ready; they will have already been told to execute this turn.

Definition at line 266 of file NetTurnManager.h.

u32 CNetServerTurnManager::GetSavedTurnLength ( u32  turn)

Returns the turn length that was used for the given turn.

Requires turn <= GetReadyTurn().

Definition at line 592 of file NetTurnManager.cpp.

void CNetServerTurnManager::InitialiseClient ( int  client,
u32  turn 
)

Inform the turn manager of a new client who will be sending commands.

Definition at line 565 of file NetTurnManager.cpp.

CNetServerTurnManager::NONCOPYABLE ( CNetServerTurnManager  )
private
void CNetServerTurnManager::NotifyFinishedClientCommands ( int  client,
u32  turn 
)

Definition at line 477 of file NetTurnManager.cpp.

void CNetServerTurnManager::NotifyFinishedClientUpdate ( int  client,
u32  turn,
const std::string &  hash 
)

Definition at line 518 of file NetTurnManager.cpp.

void CNetServerTurnManager::SetTurnLength ( u32  msecs)

Definition at line 587 of file NetTurnManager.cpp.

void CNetServerTurnManager::UninitialiseClient ( int  client)

Inform the turn manager that a previously-initialised client has left the game and will no longer be sending commands.

Definition at line 574 of file NetTurnManager.cpp.

Member Data Documentation

std::map<int, u32> CNetServerTurnManager::m_ClientsReady
protected

Definition at line 281 of file NetTurnManager.h.

std::map<int, u32> CNetServerTurnManager::m_ClientsSimulated
protected

Definition at line 285 of file NetTurnManager.h.

std::map<u32, std::map<int, std::string> > CNetServerTurnManager::m_ClientStateHashes
protected

Definition at line 288 of file NetTurnManager.h.

CNetServerWorker& CNetServerTurnManager::m_NetServer
protected

Definition at line 296 of file NetTurnManager.h.

u32 CNetServerTurnManager::m_ReadyTurn
protected

The latest turn for which we have received all commands from all clients.

Definition at line 278 of file NetTurnManager.h.

std::vector<u32> CNetServerTurnManager::m_SavedTurnLengths
protected

Definition at line 294 of file NetTurnManager.h.

u32 CNetServerTurnManager::m_TurnLength
protected

Definition at line 291 of file NetTurnManager.h.


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