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/CarrierAI.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/CarrierAI.cpp')
-rw-r--r-- | Stars45/CarrierAI.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Stars45/CarrierAI.cpp b/Stars45/CarrierAI.cpp index d7194a4..235a073 100644 --- a/Stars45/CarrierAI.cpp +++ b/Stars45/CarrierAI.cpp @@ -49,7 +49,7 @@ CarrierAI::CarrierAI(Ship* s, int level) if (ship) flight_planner = new(__FILE__,__LINE__) FlightPlanner(ship); - hold_time = (int) Game::GetInstance()->GameTime(); + hold_time = (int) Game::GetInstance()->GetClock()->GameTime(); } } @@ -69,13 +69,13 @@ CarrierAI::ExecFrame(double secs) if (!sim || !ship || !hangar) return; - if (((int) Game::GetInstance()->GameTime() - hold_time >= INIT_HOLD) && - ((int) Game::GetInstance()->GameTime() - exec_time > EXEC_PERIOD)) { + if (((int) Game::GetInstance()->GetClock()->GameTime() - hold_time >= INIT_HOLD) && + ((int) Game::GetInstance()->GetClock()->GameTime() - exec_time > EXEC_PERIOD)) { CheckHostileElements(); CheckPatrolCoverage(); - exec_time = (int) Game::GetInstance()->GameTime(); + exec_time = (int) Game::GetInstance()->GetClock()->GameTime(); } } @@ -132,7 +132,7 @@ CarrierAI::CheckPatrolCoverage() } } - else if (Game::GetInstance()->GameTime() - hangar->GetLastPatrolLaunch() > PATROL_PERIOD || + else if (Game::GetInstance()->GetClock()->GameTime() - hangar->GetLastPatrolLaunch() > PATROL_PERIOD || hangar->GetLastPatrolLaunch() == 0) { Element* patrol = CreatePackage(0, 2, Mission::PATROL, 0, "ACM Medium Range"); if (patrol) { @@ -141,7 +141,7 @@ CarrierAI::CheckPatrolCoverage() if (flight_planner) flight_planner->CreatePatrolRoute(patrol, i); - hangar->SetLastPatrolLaunch(Game::GetInstance()->GameTime()); + hangar->SetLastPatrolLaunch(Game::GetInstance()->GetClock()->GameTime()); return true; } } @@ -194,7 +194,7 @@ CarrierAI::CheckHostileElements() // nobody is assigned yet, create an attack package if (!found && CreateStrike(elem)) { - hold_time = (int) Game::GetInstance()->GameTime() + 30000; + hold_time = (int) Game::GetInstance()->GetClock()->GameTime() + 30000; return true; } } |