From 0da933a0146a0689546b21231e14f2dfc2bc14e8 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 23 Feb 2022 23:36:37 +0100 Subject: Switched to use ContentBundle's GetText --- Stars45/FighterAI.cpp | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'Stars45/FighterAI.cpp') diff --git a/Stars45/FighterAI.cpp b/Stars45/FighterAI.cpp index 409a89b..029b928 100644 --- a/Stars45/FighterAI.cpp +++ b/Stars45/FighterAI.cpp @@ -34,6 +34,7 @@ #include "RadioTraffic.h" #include "Game.h" +#include "ContentBundle.h" static const double TIME_TO_DOCK = 30; @@ -211,7 +212,7 @@ FighterAI::FindObjective() // transform into camera coords: objective = Transform(obj_w); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.launch")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.launch")); return; } else { @@ -226,7 +227,7 @@ FighterAI::FindObjective() // transform into camera coords: objective = Transform(obj_w); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.takeoff")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.takeoff")); return; } @@ -247,14 +248,14 @@ FighterAI::FindObjective() // transform into camera coords: objective = Transform(obj_w); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.inbound")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.inbound")); return; } // final approach else { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.finals")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.finals")); obj_w = deck->StartPoint(); if (inbound->Final()) { @@ -427,7 +428,7 @@ FighterAI::ReturnToBase(Ship* controller) // transform into camera coords: objective = Transform(obj_w); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.return-to-base")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.return-to-base")); rtb_code = 1; } @@ -626,7 +627,7 @@ FighterAI::Navigator() } if (target) - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-target")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-target")); accumulator.Clear(); magnitude = 0; @@ -716,7 +717,7 @@ FighterAI::HelmControl() } else { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.station-keeping")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.station-keeping")); station_keeping = true; // go into a slow orbit if airborne: @@ -1121,7 +1122,7 @@ FighterAI::AvoidTerrain() if (ship->AltitudeMSL() > 25e3) { if (!navpt || (navpt->Region() == ship->GetRegion() && navpt->Location().z < 27e3)) { terrain_warning = true; - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.too-high")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.too-high")); // where will we be? Point selfpt = ship->Location() + ship->Velocity() + Point(0, -15e3, 0); @@ -1137,11 +1138,11 @@ FighterAI::AvoidTerrain() // too low? else if (ship->AltitudeAGL() < 2500) { terrain_warning = true; - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.too-low")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.too-low")); // way too low? if (ship->AltitudeAGL() < 1500) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.way-too-low")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.way-too-low")); target = 0; drop_time = 5; } @@ -1189,7 +1190,7 @@ FighterAI::SeekTarget() if (patrol) { Steer result = Seek(objective); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-patrol-point")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-patrol-point")); if (distance < 10 * self->Radius()) { patrol = 0; @@ -1209,7 +1210,7 @@ FighterAI::SeekTarget() result.stop = 1; } else { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-inbound")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-inbound")); // approach legs: if (inbound->Approach() > 0) { @@ -1241,7 +1242,7 @@ FighterAI::SeekTarget() } else if (!inbound->Cleared() && distance < 2000) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.hold-final")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.hold-final")); result = Steer(); result.brake = 1; result.stop = 1; @@ -1267,7 +1268,7 @@ FighterAI::SeekTarget() } else if (navpt && navpt->Action() == Instruction::LAUNCH) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.launch")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.launch")); return Seek(objective); } @@ -1276,7 +1277,7 @@ FighterAI::SeekTarget() if (element_index > 1) return SeekFormationSlot(); - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-farcaster")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-farcaster")); return Seek(objective); } @@ -1338,13 +1339,13 @@ FighterAI::SeekTarget() return Steer(); } - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-target")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-target")); return Seek(objective); } } if (navpt) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-navpt")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-navpt")); } return Seek(objective); @@ -1414,7 +1415,7 @@ FighterAI::SeekFormationSlot() } seeking = 1; - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.seek-formation")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.seek-formation")); return s; } @@ -1497,7 +1498,7 @@ FighterAI::EvadeThreat() } // beam the missile - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.evade-missile")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.evade-missile")); Point beam_line = threat_missile->Velocity().cross(Point(0,1,0)); beam_line.Normalize(); @@ -1530,7 +1531,7 @@ FighterAI::EvadeThreat() } if (threat_dist <= threat_range) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.evade-threat")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.evade-threat")); if (ship->IsAirborne()) { evading = true; @@ -1553,7 +1554,7 @@ FighterAI::EvadeThreat() } if (!target) { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.evade-starship")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.evade-starship")); // flee for three seconds: if ((ship->MissionClock() & 3) != 3) { @@ -1577,7 +1578,7 @@ FighterAI::EvadeThreat() } else { - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.evade-and-seek")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.evade-and-seek")); // seek for three seconds: if ((ship->MissionClock() & 3) < 3) { @@ -1622,9 +1623,9 @@ FighterAI::EvadeThreat() } if (target) - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.evade-and-seek")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.evade-and-seek")); else - ship->SetDirectorInfo(Game::GetInstance()->GetText("ai.random-evade")); + ship->SetDirectorInfo(ContentBundle::GetInstance()->GetText("ai.random-evade")); // beam the threat Point beam_line = threat->Velocity().cross(Point(0,1,0)); -- cgit v1.1