Pyrogenesis  trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CNetServerTurnManager Class Reference

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

#include <NetServerTurnManager.h>

Collaboration diagram for CNetServerTurnManager:
Collaboration graph
[legend]

Public Member Functions

 CNetServerTurnManager (CNetServerWorker &server)
 
void NotifyFinishedClientCommands (int client, u32 turn)
 
void NotifyFinishedClientUpdate (int client, const CStrW &playername, u32 turn, const CStr &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...
 

Private Member Functions

 NONCOPYABLE (CNetServerTurnManager)
 
void CheckClientsReady ()
 

Private 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
 
std::map< u32, CStrW > m_ClientPlayernames
 
u32 m_TurnLength
 
std::vector< u32m_SavedTurnLengths
 
CNetServerWorkerm_NetServer
 
bool m_HasSyncError
 

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:

Constructor & Destructor Documentation

CNetServerTurnManager::CNetServerTurnManager ( CNetServerWorker server)

Member Function Documentation

void CNetServerTurnManager::CheckClientsReady ( )
private
u32 CNetServerTurnManager::GetReadyTurn ( )
inline

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

u32 CNetServerTurnManager::GetSavedTurnLength ( u32  turn)

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

Requires turn <= GetReadyTurn().

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

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

CNetServerTurnManager::NONCOPYABLE ( CNetServerTurnManager  )
private
void CNetServerTurnManager::NotifyFinishedClientCommands ( int  client,
u32  turn 
)
void CNetServerTurnManager::NotifyFinishedClientUpdate ( int  client,
const CStrW &  playername,
u32  turn,
const CStr &  hash 
)
void CNetServerTurnManager::SetTurnLength ( u32  msecs)
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.

Member Data Documentation

std::map<u32, CStrW> CNetServerTurnManager::m_ClientPlayernames
private
std::map<int, u32> CNetServerTurnManager::m_ClientsReady
private
std::map<int, u32> CNetServerTurnManager::m_ClientsSimulated
private
std::map<u32, std::map<int, std::string> > CNetServerTurnManager::m_ClientStateHashes
private
bool CNetServerTurnManager::m_HasSyncError
private
CNetServerWorker& CNetServerTurnManager::m_NetServer
private
u32 CNetServerTurnManager::m_ReadyTurn
private

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

std::vector<u32> CNetServerTurnManager::m_SavedTurnLengths
private
u32 CNetServerTurnManager::m_TurnLength
private

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