diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx
index 0306c3ec5..2f5bb4f6f 100644
--- a/src/AIModel/AIBallistic.cxx
+++ b/src/AIModel/AIBallistic.cxx
@@ -479,6 +479,10 @@ bool FGAIBallistic::getSlaved() const {
     return _slave_to_ac;
 }
 
+bool FGAIBallistic::getFormate() const {
+    return _formate_to_ac;
+}
+
 double FGAIBallistic::getMass() const {
     return _mass;
 }
diff --git a/src/AIModel/AIBallistic.hxx b/src/AIModel/AIBallistic.hxx
index c9613de89..91a50acbd 100644
--- a/src/AIModel/AIBallistic.hxx
+++ b/src/AIModel/AIBallistic.hxx
@@ -105,6 +105,7 @@ public:
 
     bool getHtAGL(double start);
     bool getSlaved() const;
+    bool getFormate() const;
     bool getSlavedLoad() const;
 
     virtual const char* getTypeString(void) const { return "ballistic"; }
diff --git a/src/AIModel/AIEscort.cxx b/src/AIModel/AIEscort.cxx
index c9901ca24..20d09d252 100644
--- a/src/AIModel/AIEscort.cxx
+++ b/src/AIModel/AIEscort.cxx
@@ -142,7 +142,7 @@ bool FGAIEscort::init(bool search_in_AI_path) {
     no_roll = false;
 
     props->setStringValue("controls/parent-name", _parent.c_str());
-    setParent();
+    setParentNode();
     pos = _tgtpos;
     speed = _parent_speed;
     hdg = _parent_hdg;
@@ -233,7 +233,7 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) {
 
 }
 
-void FGAIEscort::setParent() {
+void FGAIEscort::setParentNode() {
 
     const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
 
@@ -263,29 +263,75 @@ void FGAIEscort::setParent() {
 
     if (_selected_ac != 0){
         const string name = _selected_ac->getStringValue("name");
-        double lat = _selected_ac->getDoubleValue("position/latitude-deg");
-        double lon = _selected_ac->getDoubleValue("position/longitude-deg");
-        double elevation = _selected_ac->getDoubleValue("position/altitude-ft");
-        _MPControl = _selected_ac->getBoolValue("controls/mp-control");
+        setParent();
 
-        _selectedpos.setLatitudeDeg(lat);
-        _selectedpos.setLongitudeDeg(lon);
-        _selectedpos.setElevationFt(elevation);
+        //double lat = _selected_ac->getDoubleValue("position/latitude-deg");
+        //double lon = _selected_ac->getDoubleValue("position/longitude-deg");
+        //double elevation = _selected_ac->getDoubleValue("position/altitude-ft");
+        //_MPControl = _selected_ac->getBoolValue("controls/mp-control");
 
-        _parent_speed    = _selected_ac->getDoubleValue("velocities/speed-kts");
-        _parent_hdg      = _selected_ac->getDoubleValue("orientation/true-heading-deg");
+        //_selectedpos.setLatitudeDeg(lat);
+        //_selectedpos.setLongitudeDeg(lon);
+        //_selectedpos.setElevationFt(elevation);
 
-        if(!_stn_deg_true){
-            _stn_truebrg = calcTrueBearingDeg(_stn_brg, _parent_hdg);
-            _stn_relbrg = _stn_brg;
-            //cout << _name <<" set rel"<<endl;
-        } else {
-            _stn_truebrg = _stn_brg;
-            _stn_relbrg = calcRelBearingDeg(_stn_brg, _parent_hdg); 
-            //cout << _name << " set true"<<endl;
-        }
+        //_parent_speed    = _selected_ac->getDoubleValue("velocities/speed-kts");
+        //_parent_hdg      = _selected_ac->getDoubleValue("orientation/true-heading-deg");
 
-        double course2;
+        //if(!_stn_deg_true){
+        //    _stn_truebrg = calcTrueBearingDeg(_stn_brg, _parent_hdg);
+        //    _stn_relbrg = _stn_brg;
+        //    //cout << _name <<" set rel"<<endl;
+        //} else {
+        //    _stn_truebrg = _stn_brg;
+        //    _stn_relbrg = calcRelBearingDeg(_stn_brg, _parent_hdg); 
+        //    //cout << _name << " set true"<<endl;
+        //}
+
+        //double course2;
+
+        //SGGeodesy::direct( _selectedpos, _stn_truebrg, _stn_range * SG_NM_TO_METER,
+        //    _tgtpos, course2);
+
+        //_tgtpos.setElevationFt(_stn_height);
+
+        //calcRangeBearing(pos.getLatitudeDeg(), pos.getLongitudeDeg(),
+        //    _tgtpos.getLatitudeDeg(), _tgtpos.getLongitudeDeg(), _tgtrange, _tgtbrg);
+
+        //_relbrg = calcRelBearingDeg(_tgtbrg, hdg);
+
+    } else {
+        SG_LOG(SG_GENERAL, SG_ALERT, "AIEscort: " << _name
+            << " parent not found: dying ");
+        setDie(true);
+    }
+
+}
+
+void FGAIEscort::setParent()
+{
+    double lat = _selected_ac->getDoubleValue("position/latitude-deg");
+    double lon = _selected_ac->getDoubleValue("position/longitude-deg");
+    double elevation = _selected_ac->getDoubleValue("position/altitude-ft");
+    _MPControl = _selected_ac->getBoolValue("controls/mp-control");
+
+    _selectedpos.setLatitudeDeg(lat);
+    _selectedpos.setLongitudeDeg(lon);
+    _selectedpos.setElevationFt(elevation);
+
+    _parent_speed    = _selected_ac->getDoubleValue("velocities/speed-kts");
+    _parent_hdg      = _selected_ac->getDoubleValue("orientation/true-heading-deg");
+
+    if(!_stn_deg_true){
+        _stn_truebrg = calcTrueBearingDeg(_stn_brg, _parent_hdg);
+        _stn_relbrg = _stn_brg;
+        //cout << _name <<" set rel"<<endl;
+    } else {
+        _stn_truebrg = _stn_brg;
+        _stn_relbrg = calcRelBearingDeg(_stn_brg, _parent_hdg); 
+        //cout << _name << " set true"<<endl;
+    }
+
+            double course2;
 
         SGGeodesy::direct( _selectedpos, _stn_truebrg, _stn_range * SG_NM_TO_METER,
             _tgtpos, course2);
@@ -297,12 +343,6 @@ void FGAIEscort::setParent() {
 
         _relbrg = calcRelBearingDeg(_tgtbrg, hdg);
 
-    } else {
-        SG_LOG(SG_GENERAL, SG_ALERT, "AIEscort: " << _name
-            << " parent not found: dying ");
-        setDie(true);
-    }
-
 }
 
 void FGAIEscort::calcRangeBearing(double lat, double lon, double lat2, double lon2,
diff --git a/src/AIModel/AIEscort.hxx b/src/AIModel/AIEscort.hxx
index d5adff5d5..57a60ccb9 100644
--- a/src/AIModel/AIEscort.hxx
+++ b/src/AIModel/AIEscort.hxx
@@ -51,7 +51,7 @@ private:
     virtual void update (double dt);
 
     void setParentName(const std::string& p);
-    void setParent();
+    void setParentNode();
     void setStnRange(double r);
     void setStnBrg(double y);
     void setStationSpeed();
@@ -61,6 +61,7 @@ private:
     void setStnHtFt(double h);
     void setStnPatrol(bool p);
     void setStnDegTrue(bool t);
+    void setParent();
 
     void setMaxSpeed(double m);
     void setUpdateInterval(double i);
diff --git a/src/AIModel/AIGroundVehicle.cxx b/src/AIModel/AIGroundVehicle.cxx
index e65ea5b7e..10ea47e59 100644
--- a/src/AIModel/AIGroundVehicle.cxx
+++ b/src/AIModel/AIGroundVehicle.cxx
@@ -61,9 +61,9 @@ void FGAIGroundVehicle::readFromScenario(SGPropertyNode* scFileNode) {
 
     FGAIShip::readFromScenario(scFileNode);
 
-    setNoRoll(scFileNode->getBoolValue("no-roll", true));
     setName(scFileNode->getStringValue("name", "groundvehicle"));
-    setSMPath(scFileNode->getStringValue("submodel-path", ""));
+    setParentName(scFileNode->getStringValue("parent", ""));
+    setNoRoll(scFileNode->getBoolValue("no-roll", true));
     setContactX1offset(scFileNode->getDoubleValue("contact-x1-offset", 0.0));
     setContactX2offset(scFileNode->getDoubleValue("contact-x2-offset", 0.0));
     setXOffset(scFileNode->getDoubleValue("hitch-x-offset", 35.0));
@@ -74,7 +74,6 @@ void FGAIGroundVehicle::readFromScenario(SGPropertyNode* scFileNode) {
     setYawoffset(scFileNode->getDoubleValue("yaw-offset", 0.0));
     setPitchCoeff(scFileNode->getDoubleValue("pitch-coefficient", 0.1));
     setElevCoeff(scFileNode->getDoubleValue("elevation-coefficient", 0.25));
-    setParentName(scFileNode->getStringValue("parent", ""));
     setTowAngleGain(scFileNode->getDoubleValue("tow-angle-gain", 1.0));
     setTowAngleLimit(scFileNode->getDoubleValue("tow-angle-limit-deg", 2.0));
     setInitialTunnel(scFileNode->getBoolValue("tunnel", false));
@@ -125,7 +124,7 @@ void FGAIGroundVehicle::unbind() {
     FGAIShip::unbind();
 
     props->untie("controls/constants/elevation-coeff");
-	props->untie("controls/constants/pitch-coeff");
+    props->untie("controls/constants/pitch-coeff");
     props->untie("position/ht-AGL-ft");
     props->untie("hitch/rel-bearing-deg");
     props->untie("hitch/tow-angle-deg");
@@ -149,6 +148,9 @@ bool FGAIGroundVehicle::init(bool search_in_AI_path) {
     invisible = false;
     _limit = 200;
     no_roll = true;
+
+    props->setStringValue("controls/parent-name", _parent.c_str());
+    setParentNode();
 
     return true;
 }
@@ -342,12 +344,15 @@ bool FGAIGroundVehicle::getPitch() {
 
     }
 
-    getGroundElev(pos);
+    //getGroundElev(pos);
 
     return true;
 }
 
-void FGAIGroundVehicle::setParent() {
+void FGAIGroundVehicle::setParentNode() {
+
+    if(_parent == "")
+        return;
 
     const SGPropertyNode_ptr ai = fgGetNode("/ai/models", true);
 
@@ -377,40 +382,16 @@ void FGAIGroundVehicle::setParent() {
 
     if (_selected_ac != 0){
         const string name = _selected_ac->getStringValue("name");
-        double lat = _selected_ac->getDoubleValue("position/latitude-deg");
-        double lon = _selected_ac->getDoubleValue("position/longitude-deg");
-        double elevation = _selected_ac->getDoubleValue("position/altitude-ft");
-        double hitch_x_offset_m = _selected_ac->getDoubleValue("hitch/x-offset-ft")
-            * SG_FEET_TO_METER;
-        double hitch_y_offset_m = _selected_ac->getDoubleValue("hitch/y-offset-ft")
-            * SG_FEET_TO_METER;
-        double hitch_z_offset_m = _selected_ac->getDoubleValue("hitch/z-offset-ft")
-            * SG_FEET_TO_METER;
-        
-        _selectedpos.setLatitudeDeg(lat);
-        _selectedpos.setLongitudeDeg(lon);
-        _selectedpos.setElevationFt(elevation);
-
         _parent_x_offset = _selected_ac->getDoubleValue("hitch/x-offset-ft");
         _parent_y_offset = _selected_ac->getDoubleValue("hitch/y-offset-ft");
         _parent_z_offset = _selected_ac->getDoubleValue("hitch/z-offset-ft");
-
-        _parent_speed    = _selected_ac->getDoubleValue("velocities/true-airspeed-kt");
-
-        SGVec3d rear_hitch(-hitch_x_offset_m, hitch_y_offset_m, 0);
-        SGVec3d RearHitch = getCartHitchPosAt(rear_hitch);
-
-        SGGeod rearpos = SGGeod::fromCart(RearHitch);
-
-        double user_lat = rearpos.getLatitudeDeg();
-        double user_lon = rearpos.getLongitudeDeg();
-
-        double range, bearing;
-
-        calcRangeBearing(pos.getLatitudeDeg(), pos.getLongitudeDeg(),
-            user_lat, user_lon, range, bearing);
-        _range_ft = range * 6076.11549;
-        _relbrg = calcRelBearingDeg(bearing, hdg);
+        _hitch_x_offset_m = _selected_ac->getDoubleValue("hitch/x-offset-ft")
+            * SG_FEET_TO_METER;
+        _hitch_y_offset_m = _selected_ac->getDoubleValue("hitch/y-offset-ft")
+            * SG_FEET_TO_METER;
+        _hitch_z_offset_m = _selected_ac->getDoubleValue("hitch/z-offset-ft")
+            * SG_FEET_TO_METER;
+        setParent();
     } else {
         SG_LOG(SG_GENERAL, SG_ALERT, "AIGroundVeh1cle: " << _name
                 << " parent not found: dying ");
@@ -419,6 +400,34 @@ void FGAIGroundVehicle::setParent() {
 
 }
 
+void FGAIGroundVehicle::setParent(){
+
+    double lat = _selected_ac->getDoubleValue("position/latitude-deg");
+    double lon = _selected_ac->getDoubleValue("position/longitude-deg");
+    double elevation = _selected_ac->getDoubleValue("position/altitude-ft");
+
+    _selectedpos.setLatitudeDeg(lat);
+    _selectedpos.setLongitudeDeg(lon);
+    _selectedpos.setElevationFt(elevation);
+
+    _parent_speed = _selected_ac->getDoubleValue("velocities/true-airspeed-kt");
+
+    SGVec3d rear_hitch(-_hitch_x_offset_m, _hitch_y_offset_m, 0);
+    SGVec3d RearHitch = getCartHitchPosAt(rear_hitch);
+
+    SGGeod rearpos = SGGeod::fromCart(RearHitch);
+
+    double user_lat = rearpos.getLatitudeDeg();
+    double user_lon = rearpos.getLongitudeDeg();
+
+    double range, bearing;
+
+    calcRangeBearing(pos.getLatitudeDeg(), pos.getLongitudeDeg(),
+        user_lat, user_lon, range, bearing);
+    _range_ft = range * 6076.11549;
+    _relbrg = calcRelBearingDeg(bearing, hdg);
+}
+
 void FGAIGroundVehicle::calcRangeBearing(double lat, double lon, double lat2, double lon2,
                             double &range, double &bearing) const
 {
diff --git a/src/AIModel/AIGroundVehicle.hxx b/src/AIModel/AIGroundVehicle.hxx
index 721ebf303..4ea7eea98 100644
--- a/src/AIModel/AIGroundVehicle.hxx
+++ b/src/AIModel/AIGroundVehicle.hxx
@@ -65,6 +65,7 @@ private:
     void setParentName(const string& p);
     void setTrainSpeed(double s, double dt, double coeff);
     void setParent();
+    void setParentNode();
     void AdvanceFP();
     void setTowSpeed();
     void RunGroundVehicle(double dt);
@@ -93,6 +94,7 @@ private:
     double _range_ft;
     double _relbrg;
     double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;
+    double _hitch_x_offset_m, _hitch_y_offset_m, _hitch_z_offset_m;
     double _dt_count, _next_run, _break_count;
 
     const SGMaterial* _material;
diff --git a/src/AIModel/AIShip.cxx b/src/AIModel/AIShip.cxx
index 41f09550e..b27b21d96 100644
--- a/src/AIModel/AIShip.cxx
+++ b/src/AIModel/AIShip.cxx
@@ -99,6 +99,7 @@ void FGAIShip::readFromScenario(SGPropertyNode* scFileNode) {
     setRudderConstant(scFileNode->getDoubleValue("rudder-constant", 0.5));
     setFixedTurnRadius(scFileNode->getDoubleValue("fixed-turn-radius-ft", 500));
     setSpeedConstant(scFileNode->getDoubleValue("speed-constant", 0.5));
+    setSMPath(scFileNode->getStringValue("submodel-path", ""));
 
     if (!flightplan.empty()) {
         SG_LOG(SG_GENERAL, SG_ALERT, "getting flightplan: " << _name );
@@ -250,12 +251,12 @@ void FGAIShip::update(double dt) {
     // Update the velocity information stored in those nodes.
     // Transform that one to the horizontal local coordinate system.
     SGQuatd ec2hl = SGQuatd::fromLonLat(pos);
-    // The orientation of the carrier wrt the horizontal local frame
+    // The orientation of the ship wrt the horizontal local frame
     SGQuatd hl2body = SGQuatd::fromYawPitchRollDeg(hdg, pitch, roll);
     // and postrotate the orientation of the AIModel wrt the horizontal
     // local frame
     SGQuatd ec2body = ec2hl*hl2body;
-    // The cartesian position of the carrier in the wgs84 world
+    // The cartesian position of the ship in the wgs84 world
     SGVec3d cartPos = SGVec3d::fromGeod(pos);
 
     // The simulation time this transform is meant for
@@ -680,7 +681,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
         if (_next_name == "TUNNEL"){
             _tunnel = !_tunnel;
 
-            SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " " << sp_turn_radius_nm );
+            SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " " << sp_turn_radius_nm );
 
             fp->IncrementWaypoint(false);
             next = fp->getNextWaypoint();
@@ -697,7 +698,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
         }else if(_next_name == "END" || fp->getNextWaypoint() == 0) {
 
             if (_repeat) {
-                SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: "<< _name << " Flightplan repeating ");
+                SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "<< _name << " Flightplan repeating ");
                 fp->restart();
                 prev = curr;
                 curr = fp->getCurrentWaypoint();
@@ -711,7 +712,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
                 _lead_angle = 0;
                 AccelTo(prev->speed);
             } else if (_restart){
-                SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " Flightplan restarting ");
+                SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " Flightplan restarting ");
                 _missed_count = 0;
                 initFlightPlan();
             } else {
@@ -755,7 +756,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
             _until_time = next->time;
             setUntilTime(next->time);
             if (until_time_sec > time_sec) {
-                SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " "
+                SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " "
                     << curr->name << " waiting until: "
                     << _until_time << " " << until_time_sec << " now " << time_sec );
                 setSpeed(0);
@@ -763,7 +764,7 @@ void FGAIShip::ProcessFlightPlan(double dt) {
                 _waiting = true;
                 return;
             } else {
-                SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: "
+                SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "
                     << _name << " wait until done: getting new waypoints ");
                 setUntilTime("");
                 fp->IncrementWaypoint(false);
diff --git a/src/AIModel/AIWingman.cxx b/src/AIModel/AIWingman.cxx
index 39c20bbc6..2bc8e2c0f 100644
--- a/src/AIModel/AIWingman.cxx
+++ b/src/AIModel/AIWingman.cxx
@@ -75,6 +75,11 @@ void FGAIWingman::bind() {
         &FGAIBase::_getLongitude,
         &FGAIBase::_setLongitude));
 
+    props->tie("controls/formate-to-ac",
+        SGRawValueMethods<FGAIBallistic,bool>
+        (*this, &FGAIBallistic::getFormate, &FGAIBallistic::setFormate));
+
+
     props->tie("orientation/pitch-deg",   SGRawValuePointer<double>(&pitch));
     props->tie("orientation/roll-deg",    SGRawValuePointer<double>(&roll));
     props->tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
@@ -122,6 +127,8 @@ void FGAIWingman::unbind() {
     props->untie("orientation/roll-deg");
     props->untie("orientation/true-heading-deg");
 
+    props->untie("controls/formate-to-ac");
+
     props->untie("submodels/serviceable");
 
     props->untie("velocities/true-airspeed-kt");
diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx
index 471b45dd1..8963be719 100644
--- a/src/AIModel/submodel.cxx
+++ b/src/AIModel/submodel.cxx
@@ -515,9 +515,7 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
 {
     SGPropertyNode root;
 
-    SGPath config(globals->get_fg_root());
-    config.append(path);
-    SG_LOG(SG_GENERAL, SG_DEBUG, "setData: path " << path);
+    SGPath config = globals->resolve_aircraft_path(path);
     try {
         SG_LOG(SG_GENERAL, SG_DEBUG,
                 "Submodels: Trying to read AI submodels file: " << config.str());
@@ -620,10 +618,7 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
 void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable)
 {
     SGPropertyNode root;
-
-    SGPath config(globals->get_fg_root());
-    config.append(path);
-    SG_LOG(SG_GENERAL, SG_DEBUG, "setSubData: path " << path);
+    SGPath config = globals->resolve_aircraft_path(path);
 
     try {
         SG_LOG(SG_GENERAL, SG_DEBUG,
diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx
index 208fa402b..57d7ba42e 100644
--- a/src/Environment/fgclouds.cxx
+++ b/src/Environment/fgclouds.cxx
@@ -66,7 +66,7 @@ void FGClouds::set_update_event(int count) {
 
 void FGClouds::init(void) {
 	if( snd_lightning == NULL ) {
-		snd_lightning = new SGSoundSample(globals->get_fg_root().c_str(), "Sounds/thunder.wav");
+		snd_lightning = new SGSoundSample("Sounds/thunder.wav", SGPath());
 		snd_lightning->set_max_dist(7000.0f);
 		snd_lightning->set_reference_dist(3000.0f);
 		SGSoundMgr *smgr = globals->get_soundmgr();
diff --git a/src/Instrumentation/mk_viii.cxx b/src/Instrumentation/mk_viii.cxx
index 12f3ef050..22cdb723b 100755
--- a/src/Instrumentation/mk_viii.cxx
+++ b/src/Instrumentation/mk_viii.cxx
@@ -2272,13 +2272,10 @@ MK_VIII::VoicePlayer::get_sample (const char *name)
   SGSoundSample *sample = _sgr->find(refname.str());
   if (! sample)
     {
-      SGPath sample_path(globals->get_fg_root());
-      sample_path.append("Sounds/mk-viii");
-
-      string filename = string(name) + ".wav";
+      string filename = "Sounds/mk-viii" + string(name) + ".wav";
       try
 	{
-	  sample = new SGSoundSample(sample_path.c_str(), filename.c_str());
+	  sample = new SGSoundSample(filename.c_str(), SGPath());
 	}
       catch (const sg_exception &e)
 	{
diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index ddeab463b..354a92bc0 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -1211,7 +1211,7 @@ do_play_audio_sample (const SGPropertyNode * arg)
            queue->tie_to_listener();
         }
 
-        SGSoundSample *msg = new SGSoundSample(path.c_str(), file.c_str());
+        SGSoundSample *msg = new SGSoundSample(file.c_str(), path);
         msg->set_volume( volume );
         queue->add( msg );
 
diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx
index bfa51f72f..0bd14a3bc 100644
--- a/src/Main/globals.cxx
+++ b/src/Main/globals.cxx
@@ -34,6 +34,7 @@
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/structure/event_mgr.hxx>
 #include <simgear/sound/soundmgr_openal.hxx>
+#include <simgear/misc/ResourceManager.hxx>
 
 #include <Aircraft/controls.hxx>
 #include <Airports/runways.hxx>
@@ -56,7 +57,54 @@
 #include "fg_props.hxx"
 #include "fg_io.hxx"
 
-
+class AircraftResourceProvider : public simgear::ResourceProvider
+{
+public:
+  AircraftResourceProvider() :
+    simgear::ResourceProvider(simgear::ResourceManager::PRIORITY_HIGH)
+  {
+  }
+  
+  virtual SGPath resolve(const std::string& aResource, SGPath&) const
+  {
+    string_list pieces(sgPathBranchSplit(aResource));
+    if ((pieces.size() < 3) || (pieces.front() != "Aircraft")) {
+      return SGPath(); // not an Aircraft path
+    }
+    
+  // test against the aircraft-dir property
+    const char* aircraftDir = fgGetString("/sim/aircraft-dir");
+    string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir));
+    if (aircraftDirPieces.empty() || (aircraftDirPieces.back() != pieces[1])) {
+      return SGPath(); // current aircraft-dir does not match resource aircraft
+    }
+    
+    SGPath r(aircraftDir);
+    for (unsigned int i=2; i<pieces.size(); ++i) {
+      r.append(pieces[i]);
+    }
+    
+    if (r.exists()) {
+      SG_LOG(SG_IO, SG_INFO, "found path:" << aResource << " via /sim/aircraft-dir: " << r.str());
+      return r;
+    }
+  
+  // try each aircaft dir in turn
+    std::string res(aResource, 9); // resource path with 'Aircraft/' removed
+    const string_list& dirs(globals->get_aircraft_paths());
+    string_list::const_iterator it = dirs.begin();
+    for (; it != dirs.end(); ++it) {
+      SGPath p(*it, res);
+      if (p.exists()) {
+        SG_LOG(SG_IO, SG_INFO, "found path:" << aResource << " in aircraft dir: " << r.str());
+        return p;
+      }
+    } // of aircraft path iteration
+    
+    return SGPath(); // not found
+  }
+};
+
 ////////////////////////////////////////////////////////////////////////
 // Implementation of FGGlobals.
 ////////////////////////////////////////////////////////////////////////
@@ -105,7 +153,7 @@ FGGlobals::FGGlobals() :
     airwaynet( NULL ),
     multiplayer_mgr( NULL )
 {
-  
+  simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider());
 }
 
 
@@ -186,6 +234,9 @@ void FGGlobals::set_fg_root (const string &root) {
     n = n->getChild("fg-root", 0, true);
     n->setStringValue(fg_root.c_str());
     n->setAttribute(SGPropertyNode::WRITE, false);
+    
+    simgear::ResourceManager::instance()->addBasePath(fg_root, 
+      simgear::ResourceManager::PRIORITY_DEFAULT);
 }
 
 void FGGlobals::set_fg_scenery (const string &scenery)
@@ -261,60 +312,12 @@ void FGGlobals::append_aircraft_paths(const std::string& path)
 
 SGPath FGGlobals::resolve_aircraft_path(const std::string& branch) const
 {
-  string_list pieces(sgPathBranchSplit(branch));
-  if ((pieces.size() < 3) || (pieces.front() != "Aircraft")) {
-    SG_LOG(SG_AIRCRAFT, SG_ALERT, "resolve_aircraft_path: bad path:" <<  branch);
-    return SGPath();
-  }
-  
-// check current aircraft dir first (takes precedence, allows Generics to be
-// over-riden
-  const char* aircraftDir = fgGetString("/sim/aircraft-dir");
-  string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir));
-  if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) {
-    SGPath r(aircraftDir);
-    
-    for (unsigned int i=2; i<pieces.size(); ++i) {
-      r.append(pieces[i]);
-    }
-        
-    if (r.exists()) {
-      std::cout << "using aircraft-dir for:" << r.str() << std::endl;
-      return r;
-    }
-  } // of using aircraft-dir case
-  
-// try each fg_aircraft_dirs in turn
-  for (unsigned int p=0; p<fg_aircraft_dirs.size(); ++p) {
-    SGPath r(fg_aircraft_dirs[p]);
-    r.append(branch);
-    if (r.exists()) {
-      std::cout << "using aircraft directory for:" << r.str() << std::endl;
-      return r;
-    }
-  } // of fg_aircraft_dirs iteration
-
-// finally, try fg_root
-  SGPath r(fg_root);
-  r.append(branch);
-  if (r.exists()) {
-    std::cout << "using FG_ROOT for:" << r.str() << std::endl;
-    return r;
-  }
-
-  SG_LOG(SG_AIRCRAFT, SG_ALERT, "resolve_aircraft_path: failed to resolve:" << branch);
-  return SGPath();
+  return simgear::ResourceManager::instance()->findPath(branch);
 }
 
 SGPath FGGlobals::resolve_maybe_aircraft_path(const std::string& branch) const
 {
-  if (branch.find("Aircraft/") == 0) {
-    return resolve_aircraft_path(branch);
-  } else {
-    SGPath r(fg_root);
-    r.append(branch);
-    return r;
-  }
+  return simgear::ResourceManager::instance()->findPath(branch);
 }
 
 FGRenderer *
diff --git a/src/Main/main.cxx b/src/Main/main.cxx
index 7fbc9d7e4..894dd0010 100644
--- a/src/Main/main.cxx
+++ b/src/Main/main.cxx
@@ -391,7 +391,6 @@ static void fgIdleFunction ( void ) {
         globals->set_matlib( new SGMaterialLib );
         simgear::SGModelLib::init(globals->get_fg_root());
         simgear::SGModelLib::setPropRoot(globals->get_props());
-        simgear::SGModelLib::setResolveFunc(resolve_path);
         simgear::SGModelLib::setPanelFunc(load_panel);
         
         ////////////////////////////////////////////////////////////////////
diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx
index f20777714..7574332b2 100644
--- a/src/MultiPlayer/multiplaymgr.cxx
+++ b/src/MultiPlayer/multiplaymgr.cxx
@@ -159,6 +159,7 @@ FGMultiplayMgr::sIdPropertyList[] = {
   {1101, "sim/model/livery/file", simgear::props::STRING},
 
   {1200, "environment/wildfire/data", simgear::props::STRING},
+  {1201, "environment/contrail", simgear::props::INT},
 
   {1300, "tanker", simgear::props::INT},
 
diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx
index 950e0bdd0..ab0ace0a9 100644
--- a/src/Sound/fg_fx.cxx
+++ b/src/Sound/fg_fx.cxx
@@ -94,7 +94,7 @@ FGFX::init()
   
             try {
                 sound->init(globals->get_props(), node->getChild(i), this,
-                            _avionics, globals->get_fg_root());
+                            _avionics, path.dir());
   
                 _sound.push_back(sound);
             } catch ( sg_exception &e ) {
diff --git a/src/Systems/electrical.cxx b/src/Systems/electrical.cxx
index 18e80222f..d711b4dca 100644
--- a/src/Systems/electrical.cxx
+++ b/src/Systems/electrical.cxx
@@ -373,9 +373,8 @@ void FGElectricalSystem::init () {
     }
 
     if ( path.length() ) {
-        SGPath config( globals->get_fg_root() );
-        config.append( path );
-
+        SGPath config = globals->resolve_aircraft_path(path);
+        
         // load an obsolete xml configuration
         SG_LOG( SG_ALL, SG_WARN,
                 "Reading deprecated xml electrical system model from\n    "