+
+void
+FGAIManager::processScenario( const string &filename ) {
+
+ SGPropertyNode_ptr scenarioTop = loadScenarioFile(filename);
+
+ if (!scenarioTop)
+ return;
+
+ SGPropertyNode* scenarios = scenarioTop->getChild("scenario");
+
+ if (!scenarios)
+ return;
+
+ for (int i = 0; i < scenarios->nChildren(); i++) {
+ SGPropertyNode* scEntry = scenarios->getChild(i);
+
+ if (strcmp(scEntry->getName(), "entry"))
+ continue;
+ std::string type = scEntry->getStringValue("type", "aircraft");
+
+ if (type == "tanker") { // refueling scenarios
+ FGAITanker* tanker = new FGAITanker;
+ tanker->readFromScenario(scEntry);
+ attach(tanker);
+
+ } else if (type == "wingman") {
+ FGAIWingman* wingman = new FGAIWingman;
+ wingman->readFromScenario(scEntry);
+ attach(wingman);
+
+ } else if (type == "aircraft") {
+ FGAIAircraft* aircraft = new FGAIAircraft;
+ aircraft->readFromScenario(scEntry);
+ attach(aircraft);
+
+ } else if (type == "ship") {
+ FGAIShip* ship = new FGAIShip;
+ ship->readFromScenario(scEntry);
+ attach(ship);
+
+ } else if (type == "carrier") {
+ FGAICarrier* carrier = new FGAICarrier;
+ carrier->readFromScenario(scEntry);
+ attach(carrier);
+
+ } else if (type == "groundvehicle") {
+ FGAIGroundVehicle* groundvehicle = new FGAIGroundVehicle;
+ groundvehicle->readFromScenario(scEntry);
+ attach(groundvehicle);
+
+ } else if (type == "thunderstorm") {
+ FGAIStorm* storm = new FGAIStorm;
+ storm->readFromScenario(scEntry);
+ attach(storm);
+
+ } else if (type == "thermal") {
+ FGAIThermal* thermal = new FGAIThermal;
+ thermal->readFromScenario(scEntry);
+ attach(thermal);
+
+ } else if (type == "ballistic") {
+ FGAIBallistic* ballistic = new FGAIBallistic;
+ ballistic->readFromScenario(scEntry);
+ attach(ballistic);
+
+ } else if (type == "static") {
+ FGAIStatic* aistatic = new FGAIStatic;
+ aistatic->readFromScenario(scEntry);
+ attach(aistatic);
+ }
+
+ }
+