43 static bool CanLoadGame(
const std::string &filename);
46 static void SaveGame(
const std::string &filename,
Game *game);
114 float GetTimeStep()
const {
return s_timeAccelRates[m_timeAccel] * (1.0f / PHYSICS_HZ); }
132 void Init(
Game *game);
133 void LoadFromJson(
const Json &jsonObj,
Game *game);
142 View *m_spaceStationView;
150 void LoadViewsFromJson(
const Json &jsonObj);
153 static void EmitPauseState(
bool paused);
155 void SwitchToHyperspace();
156 void SwitchToNormalSpace();
159 std::unique_ptr<Views> m_gameViews;
160 std::unique_ptr<Space> m_space;
163 std::unique_ptr<Player> m_player;
171 bool m_wantHyperspace;
173 std::list<HyperspaceCloud *> m_hyperspaceClouds;
176 double m_hyperspaceProgress;
177 double m_hyperspaceDuration;
178 double m_hyperspaceEndTime;
182 bool m_forceTimeAccel;
183 static const float s_timeAccelRates[];
184 static const float s_timeInvAccelRates[];
nlohmann::json Json
Definition Json.h:8
Definition DeathView.h:14
void ToJson(Json &jsonObj)
Definition Game.cpp:189
TimeAccel GetTimeAccel() const
Definition Game.h:107
TimeAccel GetRequestedTimeAccel() const
Definition Game.h:108
void RequestTimeAccelInc(bool force=false)
Definition Game.cpp:690
View * GetInfoView() const
Definition Game.h:121
bool IsNormalSpace() const
Definition Game.h:60
double GetHyperspaceEndTime() const
Definition Game.h:81
SystemView * GetSystemView() const
Definition Game.h:117
float GetInvTimeAccelRate() const
Definition Game.h:112
double GetTime() const
Definition Game.h:65
ObjectViewerView * GetObjectViewerView() const
void WantHyperspace()
Definition Game.cpp:401
void SetTimeAccel(TimeAccel t)
Definition Game.cpp:649
TimeAccel
Definition Game.h:87
@ TIMEACCEL_1X
Definition Game.h:89
@ TIMEACCEL_10X
Definition Game.h:90
@ TIMEACCEL_HYPERSPACE
Definition Game.h:94
@ TIMEACCEL_10000X
Definition Game.h:93
@ TIMEACCEL_1000X
Definition Game.h:92
@ TIMEACCEL_100X
Definition Game.h:91
@ TIMEACCEL_PAUSED
Definition Game.h:88
void RemoveHyperspaceCloud(HyperspaceCloud *)
Definition Game.cpp:415
bool IsHyperspace() const
Definition Game.h:61
SectorView * GetSectorView() const
Definition Game.h:116
static Game * LoadGame(const std::string &filename)
Definition Game.cpp:883
const SystemPath & GetHyperspaceDest() const
Definition Game.h:83
static bool CanLoadGame(const std::string &filename)
Definition Game.cpp:898
void RequestTimeAccel(TimeAccel t, bool force=false)
Definition Game.cpp:684
float GetHyperspaceProgress() const
Definition Game.h:79
double GetHyperspaceArrivalProbability() const
Definition Game.cpp:407
bool UpdateTimeAccel()
Definition Game.cpp:315
Player * GetPlayer() const
Definition Game.h:66
WorldView * GetWorldView() const
Definition Game.h:118
float GetTimeAccelRate() const
Definition Game.h:111
double GetHyperspaceDuration() const
Definition Game.h:80
const SystemPath & GetHyperspaceSource() const
Definition Game.h:84
bool IsPaused() const
Definition Game.h:109
View * GetSpaceStationView() const
Definition Game.h:120
void TimeStep(float step)
Definition Game.cpp:287
~Game()
Definition Game.cpp:94
float GetTimeStep() const
Definition Game.h:114
Space * GetSpace() const
Definition Game.h:64
void RequestTimeAccelDec(bool force=false)
Definition Game.cpp:712
DeathView * GetDeathView() const
Definition Game.h:119
RefCountedPtr< Galaxy > GetGalaxy() const
Definition Game.h:63
static void SaveGame(const std::string &filename, Game *game)
Definition Game.cpp:908
static Json LoadGameToJson(const std::string &filename)
Definition Game.cpp:869
GameLog * log
Definition Game.h:126
Definition HyperspaceCloud.h:18
Definition ObjectViewerView.h:14
Definition RefCounted.h:36
Definition SectorView.h:23
Definition SystemPath.h:13
Definition SystemView.h:93
Definition WorldView.h:30
Definition Background.h:14
InvalidGameStartLocation(const std::string &error_)
Definition Game.h:27
std::string error
Definition Game.h:26