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

Implementation of CNetTurnManager for network clients. More...

#include <NetTurnManager.h>

Inheritance diagram for CNetClientTurnManager:
CNetTurnManager

Public Member Functions

 CNetClientTurnManager (CSimulation2 &simulation, CNetClient &client, int clientId, IReplayLogger &replay)
 
virtual void OnSimulationMessage (CSimulationMessage *msg)
 Called by networking code when a simulation message is received. More...
 
virtual void PostCommand (CScriptValRooted data)
 Called by simulation code, to add a new command to be distributed to all clients and executed soon. More...
 
- Public Member Functions inherited from CNetTurnManager
 CNetTurnManager (CSimulation2 &simulation, u32 defaultTurnLength, int clientId, IReplayLogger &replay)
 Construct for a given network session ID. More...
 
virtual ~CNetTurnManager ()
 
void ResetState (u32 newCurrentTurn, u32 newReadyTurn)
 
void SetPlayerID (int playerId)
 Set the current user's player ID, which will be added into command messages. More...
 
bool Update (float simFrameLength, size_t maxTurns)
 Advance the simulation by a certain time. More...
 
bool UpdateFastForward ()
 Advance the simulation by as much as possible. More...
 
bool WillUpdate (float simFrameLength)
 Returns whether Update(simFrameLength, ...) will process at least one new turn. More...
 
void Interpolate (float simFrameLength, float realFrameLength)
 Advance the graphics by a certain time. More...
 
virtual void OnSyncError (u32 turn, const std::string &expectedHash)
 Called when there has been an out-of-sync error. More...
 
void FinishedAllCommands (u32 turn, u32 turnLength)
 Called when all commands for a given turn have been received. More...
 
void EnableTimeWarpRecording (size_t numTurns)
 Enables the recording of state snapshots every numTurns, which can be jumped back to via RewindTimeWarp(). More...
 
void RewindTimeWarp ()
 Jumps back to the latest recorded state snapshot (if any). More...
 
void QuickSave ()
 
void QuickLoad ()
 
u32 GetCurrentTurn ()
 

Protected Member Functions

virtual void NotifyFinishedOwnCommands (u32 turn)
 Called when this client has finished sending all its commands scheduled for the given turn. More...
 
virtual void NotifyFinishedUpdate (u32 turn)
 Called when this client has finished a simulation update. More...
 
- Protected Member Functions inherited from CNetTurnManager
void AddCommand (int client, int player, CScriptValRooted data, u32 turn)
 Store a command to be executed at a given turn. More...
 
bool TurnNeedsFullHash (u32 turn)
 Returns whether we should compute a complete state hash for the given turn, instead of a quick less-complete hash. More...
 

Protected Attributes

CNetClientm_NetClient
 
- Protected Attributes inherited from CNetTurnManager
CSimulation2m_Simulation2
 
u32 m_CurrentTurn
 The turn that we have most recently executed. More...
 
u32 m_ReadyTurn
 The latest turn for which we have received all commands from all clients. More...
 
u32 m_TurnLength
 
std::deque< std::map< u32,
std::vector< SimulationCommand > > > 
m_QueuedCommands
 Commands queued at each turn (index 0 is for m_CurrentTurn+1) More...
 
int m_PlayerId
 
uint m_ClientId
 
float m_DeltaSimTime
 Simulation time remaining until we ought to execute the next turn (as a negative value to add elapsed time increments to until we reach 0). More...
 
bool m_HasSyncError
 
IReplayLoggerm_Replay
 

Detailed Description

Implementation of CNetTurnManager for network clients.

Definition at line 195 of file NetTurnManager.h.

Constructor & Destructor Documentation

CNetClientTurnManager::CNetClientTurnManager ( CSimulation2 simulation,
CNetClient client,
int  clientId,
IReplayLogger replay 
)

Definition at line 373 of file NetTurnManager.cpp.

Member Function Documentation

void CNetClientTurnManager::NotifyFinishedOwnCommands ( u32  turn)
protectedvirtual

Called when this client has finished sending all its commands scheduled for the given turn.

Implements CNetTurnManager.

Definition at line 391 of file NetTurnManager.cpp.

void CNetClientTurnManager::NotifyFinishedUpdate ( u32  turn)
protectedvirtual

Called when this client has finished a simulation update.

Implements CNetTurnManager.

Definition at line 402 of file NetTurnManager.cpp.

void CNetClientTurnManager::OnSimulationMessage ( CSimulationMessage msg)
virtual

Called by networking code when a simulation message is received.

Implements CNetTurnManager.

Definition at line 423 of file NetTurnManager.cpp.

void CNetClientTurnManager::PostCommand ( CScriptValRooted  data)
virtual

Called by simulation code, to add a new command to be distributed to all clients and executed soon.

Implements CNetTurnManager.

Definition at line 378 of file NetTurnManager.cpp.

Member Data Documentation

CNetClient& CNetClientTurnManager::m_NetClient
protected

Definition at line 209 of file NetTurnManager.h.


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