+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 == "thunderstorm") {
+ FGAIStorm* storm = new FGAIStorm;
+ storm->readFromScenario(scEntry);
+ attach(storm);