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/Contact.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/Contact.cpp')
-rw-r--r-- | Stars45/Contact.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Stars45/Contact.cpp b/Stars45/Contact.cpp index 97cba6a..a2912cb 100644 --- a/Stars45/Contact.cpp +++ b/Stars45/Contact.cpp @@ -34,14 +34,14 @@ Contact::Contact() : ship(0), shot(0), d_pas(0.0f), d_act(0.0f), track(0), ntrack(0), time(0), track_time(0), probe(false) { - acquire_time = Game::GetInstance()->GameTime(); + acquire_time = Game::GetInstance()->GetClock()->GameTime(); } Contact::Contact(Ship* s, float p, float a) : ship(s), shot(0), d_pas(p), d_act(a), track(0), ntrack(0), time(0), track_time(0), probe(false) { - acquire_time = Game::GetInstance()->GameTime(); + acquire_time = Game::GetInstance()->GetClock()->GameTime(); Observe(ship); } @@ -49,7 +49,7 @@ Contact::Contact(Shot* s, float p, float a) : ship(0), shot(s), d_pas(p), d_act(a), track(0), ntrack(0), time(0), track_time(0), probe(false) { - acquire_time = Game::GetInstance()->GameTime(); + acquire_time = Game::GetInstance()->GetClock()->GameTime(); Observe(shot); } @@ -116,7 +116,7 @@ Contact::Age() const if (!ship && !shot) return age; - double seconds = (Game::GetInstance()->GameTime() - time) / 1000.0; + double seconds = (Game::GetInstance()->GetClock()->GameTime() - time) / 1000.0; age = 1.0 - seconds/DEFAULT_TRACK_AGE; @@ -295,7 +295,7 @@ Contact::Reset() { if (Game::GetInstance()->Paused()) return; - float step_down = (float) (Game::GetInstance()->FrameTime() / 10); + float step_down = (float) (Game::GetInstance()->GetClock()->Delta() / 10); if (d_pas > 0) d_pas -= step_down; @@ -327,7 +327,7 @@ Contact::ClearTrack() void Contact::UpdateTrack() { - time = Game::GetInstance()->GameTime(); + time = Game::GetInstance()->GetClock()->GameTime(); if (shot || (ship && ship->IsGroundUnit())) return; |