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/ShipAI.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/ShipAI.cpp')
-rw-r--r-- | Stars45/ShipAI.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Stars45/ShipAI.cpp b/Stars45/ShipAI.cpp index 892f41e..c3d5a3a 100644 --- a/Stars45/ShipAI.cpp +++ b/Stars45/ShipAI.cpp @@ -279,12 +279,12 @@ ShipAI::ExecFrame(double secs) if (target == ship->GetTarget() && target->Type() == SimObject::SIM_SHIP) { // if this isn't the same ship we last called out: - if (target->Identity() != engaged_ship_id && Game::GetInstance()->GameTime() - last_call_time > 10000) { + if (target->Identity() != engaged_ship_id && Game::GetInstance()->GetClock()->GameTime() - last_call_time > 10000) { // call engaging: RadioMessage* msg = new(__FILE__,__LINE__) RadioMessage(ship->GetElement(), ship, RadioMessage::CALL_ENGAGING); msg->AddTarget(target); RadioTraffic::Transmit(msg); - last_call_time = Game::GetInstance()->GameTime(); + last_call_time = Game::GetInstance()->GetClock()->GameTime(); engaged_ship_id = target->Identity(); } @@ -1047,7 +1047,7 @@ ShipAI::AvoidCollision() last_avoid_time = 0; // check for a new obstacle immediately } - if (!other && Game::GetInstance()->GameTime() - last_avoid_time < 500) + if (!other && Game::GetInstance()->GetClock()->GameTime() - last_avoid_time < 500) return avoid; brake = 0; @@ -1124,7 +1124,7 @@ ShipAI::AvoidCollision() } } - last_avoid_time = Game::GetInstance()->GameTime(); + last_avoid_time = Game::GetInstance()->GetClock()->GameTime(); return avoid; } |