diff options
author | Aki <please@ignore.pl> | 2022-03-08 19:33:59 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-03-08 19:33:59 +0100 |
commit | e472d9537ee7919630e5f6039f8425b06f6c4213 (patch) | |
tree | c146d59b532ec1ae248727faa182102cab6365e2 /Stars45/Sim.cpp | |
parent | b563a07d9fcaa58514eeb3ec78438db56ecf2e63 (diff) | |
download | starshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.zip starshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.tar.gz starshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.tar.bz2 |
Replaced time funcs from Game with Clock equivalents
This excludes time compression stuff, as it will need some more
attention due to casting.
I don't quite like the long invocations that go through game instance
first then get the clock. It looks bad. I'll need to rethink how
modules are being made available in the codebase.
Diffstat (limited to 'Stars45/Sim.cpp')
-rw-r--r-- | Stars45/Sim.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Stars45/Sim.cpp b/Stars45/Sim.cpp index cd2fb87..3933855 100644 --- a/Stars45/Sim.cpp +++ b/Stars45/Sim.cpp @@ -395,7 +395,7 @@ Sim::ExecMission() } first_frame = true; - start_time = Game::GetInstance()->GameTime(); + start_time = Game::GetInstance()->GetClock()->GameTime(); AudioConfig::SetTraining(mission->Type() == Mission::TRAINING); } @@ -1896,7 +1896,7 @@ Sim::ProcessEventTrigger(int type, int event_id, const char* ship, int param) double Sim::MissionClock() const { - return (Game::GetInstance()->GameTime() - start_time) / 1000.0; + return (Game::GetInstance()->GetClock()->GameTime() - start_time) / 1000.0; } // +--------------------------------------------------------------------+ @@ -1933,7 +1933,7 @@ Sim::SkipCutscene() double skip_time = end_time - MissionClock(); if (skip_time > 0) { - Game::GetInstance()->SkipGameTime(skip_time); + Game::GetInstance()->GetClock()->SkipGameTime(skip_time); } } } @@ -1987,7 +1987,7 @@ Sim::ResolveTimeSkip(double seconds) player_ship->SetControls(0); } - Game::GetInstance()->SkipGameTime(skipped); + Game::GetInstance()->GetClock()->SkipGameTime(skipped); CameraDirector::SetCameraMode(CameraDirector::MODE_COCKPIT); } @@ -2510,7 +2510,7 @@ SimRegion::ExecFrame(double secs) // DON'T REALLY KNOW WHAT PURPOSE THIS SERVES.... if (!active) { double max_frame = 3 * Game::GetInstance()->GetMaxFrameLength(); - long new_time = Game::GetInstance()->GameTime(); + long new_time = Game::GetInstance()->GetClock()->GameTime(); double delta = new_time - sim_time; seconds = delta / 1000.0; @@ -2518,7 +2518,7 @@ SimRegion::ExecFrame(double secs) seconds = max_frame; } - sim_time = Game::GetInstance()->GameTime(); + sim_time = Game::GetInstance()->GetClock()->GameTime(); if (orbital_region) location = orbital_region->Location(); @@ -3798,7 +3798,7 @@ const char* FormatGameTime() { static char txt[64]; - int t = Game::GetInstance()->GameTime(); + int t = Game::GetInstance()->GetClock()->GameTime(); int h = ( t / 3600000); int m = ((t - h*3600000) / 60000); |