]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
MSVC fix.
[flightgear.git] / src / AIModel / AIBase.cxx
index d9feab65d703a19221002a9559f1552cf90eb554..3675bf6953fe33ca667e93e92e86e8d633dba549 100644 (file)
@@ -56,6 +56,7 @@ FGAIBase::FGAIBase()
     manager( NULL )
 {
     _type_str = "model";
+    tgt_heading = tgt_altitude = tgt_speed = 0.0;
     tgt_roll = roll = tgt_pitch = tgt_yaw = tgt_vs = vs = pitch = 0.0;
     bearing = elevation = range = rdot = 0.0;
     x_shift = y_shift = rotation = 0.0;
@@ -111,10 +112,14 @@ bool FGAIBase::init() {
    props = root->getNode(_type_str.c_str(), index, true);
 
    if (model_path != "") {
+    try {
       model = load3DModel( globals->get_fg_root(),
                             SGPath(model_path).c_str(),
                              props,
                             globals->get_sim_time_sec() );
+    } catch (const sg_exception &e) {
+       model = NULL;
+    }
    }
    if (model) {
      aip.init( model );
@@ -125,7 +130,7 @@ bool FGAIBase::init() {
      globals->get_scenery()->register_placement_transform(aip.getTransform());
    } else {
      if (model_path != "") { 
-       SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model.");
+       SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
      }
    } 
 
@@ -339,7 +344,7 @@ FGAIBase::getCartPosAt(const Point3D& off) const
   // Now transform to the wgs84 earth centeres system.
   Point3D pos2(pos.lon()* SGD_DEGREES_TO_RADIANS,
                pos.lat() * SGD_DEGREES_TO_RADIANS,
-               pos.elev() * SG_FEET_TO_METER);
+               pos.elev());
   Point3D cartPos3D = sgGeodToCart(pos2);
   sgdMat4 ecTrans;
   sgdMakeCoordMat4(ecTrans, cartPos3D.x(), cartPos3D.y(), cartPos3D.z(),