Changeset View
Changeset View
Standalone View
Standalone View
source/ps/Game.h
Show All 12 Lines | |||||
* | * | ||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#ifndef INCLUDED_GAME | #ifndef INCLUDED_GAME | ||||
#define INCLUDED_GAME | #define INCLUDED_GAME | ||||
#include "ps/Errors.h" | |||||
#include <vector> | #include <vector> | ||||
#include "ps/Errors.h" | |||||
#include "ps/Filesystem.h" | |||||
#include "scriptinterface/ScriptVal.h" | #include "scriptinterface/ScriptVal.h" | ||||
#include "simulation2/helpers/Player.h" | #include "simulation2/helpers/Player.h" | ||||
class CWorld; | class CWorld; | ||||
class CSimulation2; | class CSimulation2; | ||||
class CGameView; | class CGameView; | ||||
class CTurnManager; | class CTurnManager; | ||||
class IReplayLogger; | class IReplayLogger; | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* the game is paused and no updates will be performed if true. | * the game is paused and no updates will be performed if true. | ||||
**/ | **/ | ||||
bool m_Paused; | bool m_Paused; | ||||
void StartGame(JS::MutableHandleValue attribs, const std::string& savedState); | void StartGame(JS::MutableHandleValue attribs, const std::string& savedState); | ||||
PSRETURN ReallyStartGame(); | PSRETURN ReallyStartGame(); | ||||
bool StartVisualReplay(const std::string& replayPath); | bool StartVisualReplay(const OsPath& replayPath); | ||||
/** | /** | ||||
* Periodic heartbeat that controls the process. performs all per-frame updates. | * Periodic heartbeat that controls the process. performs all per-frame updates. | ||||
* Simulation update is called and game status update is called. | * Simulation update is called and game status update is called. | ||||
* | * | ||||
* @param deltaRealTime Elapsed real time since last beat/frame, in seconds. | * @param deltaRealTime Elapsed real time since last beat/frame, in seconds. | ||||
* @param doInterpolate Perform graphics interpolation if true. | * @param doInterpolate Perform graphics interpolation if true. | ||||
* @return bool false if it can't keep up with the desired simulation rate | * @return bool false if it can't keep up with the desired simulation rate | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | public: | ||||
* clamped to 0.0f. | * clamped to 0.0f. | ||||
**/ | **/ | ||||
inline void SetSimRate(float simRate) | inline void SetSimRate(float simRate) | ||||
{ if (isfinite(simRate)) m_SimRate = std::max(simRate, 0.0f); } | { if (isfinite(simRate)) m_SimRate = std::max(simRate, 0.0f); } | ||||
inline float GetSimRate() const | inline float GetSimRate() const | ||||
{ return m_SimRate; } | { return m_SimRate; } | ||||
inline std::string GetReplayPath() const | inline OsPath GetReplayPath() const | ||||
{ return m_ReplayPath; } | { return m_ReplayPath; } | ||||
/** | /** | ||||
* Replace the current turn manager. | * Replace the current turn manager. | ||||
* This class will take ownership of the pointer. | * This class will take ownership of the pointer. | ||||
*/ | */ | ||||
void SetTurnManager(CTurnManager* turnManager); | void SetTurnManager(CTurnManager* turnManager); | ||||
Show All 9 Lines | private: | ||||
std::vector<CColor> m_PlayerColors; | std::vector<CColor> m_PlayerColors; | ||||
int LoadInitialState(); | int LoadInitialState(); | ||||
std::string m_InitialSavedState; // valid between RegisterInit and LoadInitialState | std::string m_InitialSavedState; // valid between RegisterInit and LoadInitialState | ||||
bool m_IsSavedGame; // true if loading a saved game; false for a new game | bool m_IsSavedGame; // true if loading a saved game; false for a new game | ||||
int LoadVisualReplayData(); | int LoadVisualReplayData(); | ||||
std::string m_ReplayPath; | OsPath m_ReplayPath; | ||||
bool m_IsVisualReplay; | bool m_IsVisualReplay; | ||||
std::istream* m_ReplayStream; | std::istream* m_ReplayStream; | ||||
u32 m_FinalReplayTurn; | u32 m_FinalReplayTurn; | ||||
}; | }; | ||||
extern CGame *g_Game; | extern CGame *g_Game; | ||||
#endif | #endif |
Wildfire Games · Phabricator