From: Durk Talsma Date: Thu, 22 Sep 2011 17:09:36 +0000 (+0200) Subject: Merge branch 'next' of gitorious.org:fg/flightgear into next X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e00157d4e8124736873570144907b905250fe8d4;hp=54aca561b63a406e6046c0438038cd00d9c9255a;p=flightgear.git Merge branch 'next' of gitorious.org:fg/flightgear into next --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 7f9bc87c2..6634b710d 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -907,15 +907,42 @@ static bool fgSetPosFromAirportIDandParkpos( const string& id, const string& par int park_index = dcs->getNrOfParkings() - 1; bool succes; - double radius = fgGetDouble("/sim/atc/acradius"); - //cerr << "Using radius " << radius << endl; - //cerr << "Checking parkpos comparison " << (bool) (parkpos == string("AVAILABLE")) << endl; + double radius = fgGetDouble("/sim/dimensions/radius-m"); if ((parkpos == string("AVAILABLE")) && (radius > 0)) { double lat, lon, heading; - string fltType = fgGetString("/sim/atc/flight-type"); - string airline = fgGetString("/sim/atc/airline" ); + string fltType; + string acOperator; + SGPath acData; + try { + acData = fgGetString("/sim/fg-home"); + acData.append("aircraft-data"); + string acfile = fgGetString("/sim/aircraft") + string(".xml"); + acData.append(acfile); + SGPropertyNode root; + readProperties(acData.str(), &root); + SGPropertyNode * node = root.getNode("sim"); + fltType = node->getStringValue("aircraft-class", "NONE" ); + acOperator = node->getStringValue("aircraft-operator", "NONE" ); + } catch (const sg_exception &) { + SG_LOG(SG_GENERAL, SG_INFO, + "Could not load aircraft aircrat type and operator information from: " << acData.str() << ". Using defaults"); + + // cout << path.str() << endl; + } + if (fltType.empty() || fltType == "NONE") { + SG_LOG(SG_GENERAL, SG_INFO, + "Aircraft type information not found in: " << acData.str() << ". Using default value"); + fltType = fgGetString("/sim/aircraft-class" ); + } + if (acOperator.empty() || fltType == "NONE") { + SG_LOG(SG_GENERAL, SG_INFO, + "Aircraft type information not found in: " << acData.str() << ". Using default value"); + acOperator = fgGetString("/sim/aircraft-class" ); + } + + cerr << "Running aircraft " << fltType << " of livery " << acOperator << endl; string acType; // Currently not used by findAvailable parking, so safe to leave empty. - succes = dcs->getAvailableParking(&lat, &lon, &heading, &park_index, radius, fltType, acType, airline); + succes = dcs->getAvailableParking(&lat, &lon, &heading, &park_index, radius, fltType, acType, acOperator); if (succes) { fgGetString("/sim/presets/parkpos"); fgSetString("/sim/presets/parkpos", dcs->getParking(park_index)->getName());