Pyrogenesis
13997
|
The container that holds the rules, resources and attributes of the game. More...
#include <Game.h>
Public Member Functions | |
CGame (bool disableGraphics=false) | |
Constructor. More... | |
~CGame () | |
Destructor. More... | |
void | StartGame (const CScriptValRooted &attribs, const std::string &savedState) |
PSRETURN | ReallyStartGame () |
Game initialization has been completed. More... | |
bool | Update (const double deltaRealTime, bool doInterpolate=true) |
Periodic heartbeat that controls the process. More... | |
void | Interpolate (float simFrameLength, float realFrameLength) |
int | GetPlayerID () |
void | SetPlayerID (int playerID) |
void | CachePlayerColours () |
Retrieving player colours from scripts is slow, so this updates an internal cache of all players' colours. More... | |
CColor | GetPlayerColour (int player) const |
bool | IsGameStarted () const |
Get m_GameStarted. More... | |
CWorld * | GetWorld () |
Get the pointer to the game world object. More... | |
CGameView * | GetView () |
Get the pointer to the game view object. More... | |
CSimulation2 * | GetSimulation2 () |
Get the pointer to the simulation2 object. More... | |
void | SetSimRate (float simRate) |
Set the simulation scale multiplier. More... | |
float | GetSimRate () |
void | SetTurnManager (CNetTurnManager *turnManager) |
Replace the current turn manager. More... | |
CNetTurnManager * | GetTurnManager () const |
IReplayLogger & | GetReplayLogger () const |
Public Attributes | |
bool | m_Paused |
the game is paused and no updates will be performed if true. More... | |
Private Member Functions | |
NONCOPYABLE (CGame) | |
void | RegisterInit (const CScriptValRooted &attribs, const std::string &savedState) |
Initializes the game with the set of attributes provided. More... | |
int | LoadInitialState () |
Private Attributes | |
CWorld * | m_World |
pointer to the CWorld object representing the game world. More... | |
CSimulation2 * | m_Simulation2 |
pointer to the CSimulation2 object operating on the game world. More... | |
CGameView * | m_GameView |
pointer to the CGameView object representing the view into the game world. More... | |
bool | m_GameStarted |
the game has been initialized and ready for use if true. More... | |
float | m_SimRate |
Timescale multiplier for simulation rate. More... | |
int | m_PlayerID |
CNetTurnManager * | m_TurnManager |
IReplayLogger * | m_ReplayLogger |
std::vector< CColor > | m_PlayerColours |
std::string | m_InitialSavedState |
bool | m_IsSavedGame |
The container that holds the rules, resources and attributes of the game.
The CGame object is responsible for creating a game that is defined by a set of attributes provided. The CGame object is also responsible for maintaining the relations between CPlayer and CWorld, CSimulation and CWorld.
void CGame::CachePlayerColours | ( | ) |
|
inline |
|
inline |
Get the pointer to the simulation2 object.
|
inline |
|
inline |
|
inline |
void CGame::Interpolate | ( | float | simFrameLength, |
float | realFrameLength | ||
) |
|
inline |
|
private |
PSRETURN CGame::ReallyStartGame | ( | ) |
|
private |
|
inline |
void CGame::SetTurnManager | ( | CNetTurnManager * | turnManager | ) |
void CGame::StartGame | ( | const CScriptValRooted & | attribs, |
const std::string & | savedState | ||
) |
bool CGame::Update | ( | const double | deltaRealTime, |
bool | doInterpolate = true |
||
) |
Periodic heartbeat that controls the process.
performs all per-frame updates. Simulation update is called and game status update is called.
deltaRealTime | Elapsed real time since last beat/frame, in seconds. |
doInterpolate | Perform graphics interpolation if true. |
|
private |
|
private |
bool CGame::m_Paused |
|
private |
|
private |
|
private |
pointer to the CSimulation2 object operating on the game world.
|
private |
|
private |