44 static bool CanLoadGame(
const std::string &filename);
47 static void SaveGame(
const std::string &filename,
Game *game);
115 float GetTimeStep()
const {
return s_timeAccelRates[m_timeAccel] * (1.0f / PHYSICS_HZ); }
145 View *m_spaceStationView;
153 void LoadViewsFromJson(
const Json &jsonObj);
156 static void EmitPauseState(
bool paused);
158 void SwitchToHyperspace();
159 void SwitchToNormalSpace();
162 std::unique_ptr<Views> m_gameViews;
163 std::unique_ptr<Space> m_space;
166 std::unique_ptr<Player> m_player;
174 bool m_wantHyperspace;
176 std::list<HyperspaceCloud *> m_hyperspaceClouds;
179 double m_hyperspaceProgress;
180 double m_hyperspaceDuration;
181 double m_hyperspaceEndTime;
185 bool m_forceTimeAccel;
186 static const float s_timeAccelRates[];
187 static const float s_timeInvAccelRates[];
nlohmann::json Json
Definition: Json.h:8
Definition: DeathView.h:14
void ToJson(Json &jsonObj)
Definition: Game.cpp:186
Game(const SystemPath &path, const double startDateTime=0.0)
Definition: Game.cpp:38
RefCountedPtr< Galaxy > GetGalaxy() const
Definition: Game.h:64
TimeAccel GetTimeAccel() const
Definition: Game.h:108
SystemInfoView * GetSystemInfoView() const
Definition: Game.h:118
TimeAccel GetRequestedTimeAccel() const
Definition: Game.h:109
void RequestTimeAccelInc(bool force=false)
Definition: Game.cpp:684
Space * GetSpace() const
Definition: Game.h:65
bool IsNormalSpace() const
Definition: Game.h:61
double GetHyperspaceEndTime() const
Definition: Game.h:82
Player * GetPlayer() const
Definition: Game.h:67
float GetInvTimeAccelRate() const
Definition: Game.h:113
double GetTime() const
Definition: Game.h:66
void WantHyperspace()
Definition: Game.cpp:394
void SetTimeAccel(TimeAccel t)
Definition: Game.cpp:643
TimeAccel
Definition: Game.h:88
@ TIMEACCEL_1X
Definition: Game.h:90
@ TIMEACCEL_10X
Definition: Game.h:91
@ TIMEACCEL_HYPERSPACE
Definition: Game.h:95
@ TIMEACCEL_10000X
Definition: Game.h:94
@ TIMEACCEL_1000X
Definition: Game.h:93
@ TIMEACCEL_100X
Definition: Game.h:92
@ TIMEACCEL_PAUSED
Definition: Game.h:89
const SystemPath & GetHyperspaceDest() const
Definition: Game.h:84
void RemoveHyperspaceCloud(HyperspaceCloud *)
Definition: Game.cpp:408
View * GetInfoView() const
Definition: Game.h:123
bool IsHyperspace() const
Definition: Game.h:62
static Game * LoadGame(const std::string &filename)
Definition: Game.cpp:882
const SystemPath & GetHyperspaceSource() const
Definition: Game.h:85
View * GetSpaceStationView() const
Definition: Game.h:122
static bool CanLoadGame(const std::string &filename)
Definition: Game.cpp:897
DeathView * GetDeathView() const
Definition: Game.h:121
void RequestTimeAccel(TimeAccel t, bool force=false)
Definition: Game.cpp:678
float GetHyperspaceProgress() const
Definition: Game.h:80
double GetHyperspaceArrivalProbability() const
Definition: Game.cpp:400
bool UpdateTimeAccel()
Definition: Game.cpp:308
SectorView * GetSectorView() const
Definition: Game.h:117
float GetTimeAccelRate() const
Definition: Game.h:112
double GetHyperspaceDuration() const
Definition: Game.h:81
bool IsPaused() const
Definition: Game.h:110
ObjectViewerView * GetObjectViewerView() const
void TimeStep(float step)
Definition: Game.cpp:280
~Game()
Definition: Game.cpp:95
float GetTimeStep() const
Definition: Game.h:115
SystemView * GetSystemView() const
Definition: Game.h:119
void RequestTimeAccelDec(bool force=false)
Definition: Game.cpp:706
static void SaveGame(const std::string &filename, Game *game)
Definition: Game.cpp:907
static Json LoadGameToJson(const std::string &filename)
Definition: Game.cpp:868
GameLog * log
Definition: Game.h:128
WorldView * GetWorldView() const
Definition: Game.h:120
Definition: Renderer.h:39
Definition: HyperspaceCloud.h:19
Definition: ObjectViewerView.h:15
Definition: SectorView.h:25
Definition: SystemInfoView.h:23
Definition: SystemPath.h:13
Definition: SystemView.h:80
Definition: WorldView.h:33
void Init()
Definition: EnumStrings.cpp:14
void LoadFromJson(const Json &obj)
Definition: Economy.cpp:279
Definition: Background.h:13
InvalidGameStartLocation(const std::string &error_)
Definition: Game.h:27
std::string error
Definition: Game.h:26