summaryrefslogtreecommitdiffhomepage
path: root/Stars45/StarshipAI.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-08 19:33:59 +0100
committerAki <please@ignore.pl>2022-03-08 19:33:59 +0100
commite472d9537ee7919630e5f6039f8425b06f6c4213 (patch)
treec146d59b532ec1ae248727faa182102cab6365e2 /Stars45/StarshipAI.cpp
parentb563a07d9fcaa58514eeb3ec78438db56ecf2e63 (diff)
downloadstarshatter-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/StarshipAI.cpp')
-rw-r--r--Stars45/StarshipAI.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Stars45/StarshipAI.cpp b/Stars45/StarshipAI.cpp
index 3057f1d..5a32391 100644
--- a/Stars45/StarshipAI.cpp
+++ b/Stars45/StarshipAI.cpp
@@ -66,7 +66,7 @@ StarshipAI::StarshipAI(SimObject* s)
tactical = new(__FILE__,__LINE__) StarshipTacticalAI(this);
}
- sub_select_time = Game::GetInstance()->GameTime() + (DWORD) Random(0, 2000);
+ sub_select_time = Game::GetInstance()->GetClock()->GameTime() + (DWORD) Random(0, 2000);
point_defense_time = sub_select_time;
}
@@ -639,7 +639,7 @@ StarshipAI::FireControl()
System*
StarshipAI::SelectSubtarget()
{
- if (Game::GetInstance()->GameTime() - sub_select_time < 2345)
+ if (Game::GetInstance()->GetClock()->GameTime() - sub_select_time < 2345)
return subtarget;
subtarget = 0;
@@ -656,7 +656,7 @@ StarshipAI::SelectSubtarget()
double dist = 50e3;
Point svec = ship->Location() - tgt_ship->Location();
- sub_select_time = Game::GetInstance()->GameTime();
+ sub_select_time = Game::GetInstance()->GetClock()->GameTime();
// first pass: turrets
ListIter<WeaponGroup> g_iter = tgt_ship->Weapons();
@@ -727,7 +727,7 @@ StarshipAI::SelectSubtarget()
bool
StarshipAI::AssessTargetPointDefense()
{
- if (Game::GetInstance()->GameTime() - point_defense_time < 3500)
+ if (Game::GetInstance()->GetClock()->GameTime() - point_defense_time < 3500)
return tgt_point_defense;
tgt_point_defense = false;
@@ -743,7 +743,7 @@ StarshipAI::AssessTargetPointDefense()
Weapon* subtgt = 0;
Point svec = ship->Location() - tgt_ship->Location();
- point_defense_time = Game::GetInstance()->GameTime();
+ point_defense_time = Game::GetInstance()->GetClock()->GameTime();
// first pass: turrets
ListIter<WeaponGroup> g_iter = tgt_ship->Weapons();