]> git.mxchange.org Git - flightgear.git/commitdiff
Merge branch 'next' of git://gitorious.org/fg/flightgear into next
authorFrederic Bouvier <fredfgfs01@free.fr>
Sat, 2 Jul 2011 16:57:21 +0000 (18:57 +0200)
committerFrederic Bouvier <fredfgfs01@free.fr>
Sat, 2 Jul 2011 16:57:21 +0000 (18:57 +0200)
src/AIModel/AIManager.cxx
src/FDM/JSBSim/models/flight_control/FGActuator.cpp
src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/GUI/MapWidget.cxx
src/Instrumentation/heading_indicator_dg.cxx
src/Main/options.cxx

index 4190981124242bea13257c082babf70a59c18b60..91ef652717e9cba4c7bdcb0f88fdcc3e322abc2c 100644 (file)
@@ -358,9 +358,9 @@ FGAIManager::loadScenarioFile(const std::string& filename)
         SGPropertyNode_ptr root = new SGPropertyNode;
         readProperties(path.str(), root);
         return root;
-    } catch (const sg_exception &) {
-        SG_LOG(SG_GENERAL, SG_DEBUG, "Incorrect path specified for AI "
-            "scenario: \"" << path.str() << "\"");
+    } catch (const sg_exception &t) {
+        SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load scenario '"
+            << path.str() << "': " << t.getFormattedMessage());
         return 0;
     }
 }
index 6673f0452a33fc8e490f16fc7780b03f99ad6a83..9571d33f715d8b07106effe19fc50ed2a2404191 100644 (file)
@@ -43,7 +43,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGActuator.cpp,v 1.20 2011/06/18 17:46:21 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGActuator.cpp,v 1.21 2011/06/30 03:16:10 jentron Exp $";
 static const char *IdHdr = ID_ACTUATOR;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -114,13 +114,16 @@ bool FGActuator::Run(void )
                   // the Input will be further processed and the eventual Output
                   // will be overwritten from this perfect value.
 
-  if (lag != 0.0)              Lag();        // models actuator lag
-  if (rate_limit != 0)         RateLimit();  // limit the actuator rate
-  if (deadband_width != 0.0)   Deadband();
-  if (hysteresis_width != 0.0) Hysteresis();
-  if (bias != 0.0)             Bias();       // models a finite bias
+  if (fail_stuck) {
+    Output = PreviousOutput;
+  } else {
+    if (lag != 0.0)              Lag();        // models actuator lag
+    if (rate_limit != 0)         RateLimit();  // limit the actuator rate
+    if (deadband_width != 0.0)   Deadband();
+    if (hysteresis_width != 0.0) Hysteresis();
+    if (bias != 0.0)             Bias();       // models a finite bias
+  }
 
-  if (fail_stuck) Output = PreviousOutput;
   PreviousOutput = Output; // previous value needed for "stuck" malfunction
 
   Clip();
index 2fc74bd9639ded2471024fc7067c209cf3c5800b..68e699adf6d3d99a8c30b209d691578d3a55e057 100644 (file)
@@ -48,7 +48,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.32 2011/06/16 03:39:38 jberndt Exp $";
+static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.33 2011/06/21 04:41:54 jberndt Exp $";
 static const char *IdHdr = ID_FCSCOMPONENT;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -163,7 +163,7 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs, Element* element) : fcs(_fcs)
       delay = (unsigned int)(delay_time / dt);
     }
     output_array.resize(delay);
-    for (int i=0; i<delay; i++) output_array[i] = 0.0;
+    for (unsigned int i=0; i<delay; i++) output_array[i] = 0.0;
   }
 
   clip_el = element->FindElement("clipto");
index dbb5b37d1a62fe4bcfdf30e2e1b82f32d6945ce4..a39fbcec3e0e753d2d2360eeb87c7d4ac0f4354c 100644 (file)
@@ -48,7 +48,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTank.cpp,v 1.29 2011/06/06 22:39:52 jentron Exp $";
+static const char *IdSrc = "$Id: FGTank.cpp,v 1.30 2011/06/21 04:41:54 jberndt Exp $";
 static const char *IdHdr = ID_TANK;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -101,7 +101,7 @@ FGTank::FGTank(FGFDMExec* exec, Element* el, int tank_number)
   if (el->FindElement("standpipe"))
     InitialStandpipe = Standpipe = el->FindElementValueAsNumberConvertTo("standpipe", "LBS");
   if (el->FindElement("priority"))
-    InitialPriority = Priority = el->FindElementValueAsNumber("priority");
+    InitialPriority = Priority = (int)el->FindElementValueAsNumber("priority");
   if (el->FindElement("density"))
     Density = el->FindElementValueAsNumberConvertTo("density", "LBS/GAL");
   if (el->FindElement("type"))
index e3cc5de772d8aa4dab79d706316a7c52ec753579..b6f34449718f263b2220ee89cba3a1a8e898150a 100644 (file)
@@ -917,7 +917,7 @@ public:
   virtual bool pass(FGPositioned* aPos) const {
     if (_fixes && (aPos->type() == FGPositioned::FIX)) {
       // ignore fixes which end in digits - expirmental
-      if (isdigit(aPos->ident()[3]) && isdigit(aPos->ident()[4])) {
+      if (aPos->ident().length() > 4 && isdigit(aPos->ident()[3]) && isdigit(aPos->ident()[4])) {
         return false;
       }
     }
index bb9c1620e4f3e11d2f64f79633ed0a189f39b56b..0c4864912670168d9d8c3678b39e3f4bdb2f3efa 100644 (file)
@@ -115,7 +115,7 @@ HeadingIndicatorDG::update (double dt)
                                 // Next, calculate time-based precession
     double offset = _offset_node->getDoubleValue();
     offset -= dt * (0.25 / 60.0); // 360deg/day
-    SG_NORMALIZE_RANGE(offset, -360.0, 360.0);
+    offset = SGMiscd::normalizePeriodic(-360.0,360.0,offset);
     _offset_node->setDoubleValue(offset);
 
                                 // No magvar - set the alignment manually
@@ -153,7 +153,7 @@ HeadingIndicatorDG::update (double dt)
     _last_heading_deg = heading;
 
     heading += offset + align + error;
-    SG_NORMALIZE_RANGE(heading, 0.0, 360.0);
+    heading = SGMiscd::normalizePeriodic(0.0,360.0,heading);
 
     _heading_out_node->setDoubleValue(heading);
 
index 453e68e486c6066cc534043951faf707ff315969..ff306e6d9fe63018b11c7a56e04078947f3362bf 100644 (file)
@@ -1167,6 +1167,15 @@ fgOptScenario( const char *arg )
     return FG_OPTIONS_OK;
 }
 
+static int
+fgOptNoScenarios( const char *arg )
+{
+    SGPropertyNode_ptr ai_node = fgGetNode( "/sim/ai", true );
+    ai_node->removeChildren("scenario",false);
+    ai_node->setBoolValue( "enabled", false );
+    return FG_OPTIONS_OK;
+}
+
 static int
 fgOptRunway( const char *arg )
 {
@@ -1465,6 +1474,7 @@ struct OptionDesc {
     {"min-status",                   true,  OPTION_STRING,  "/sim/aircraft-min-status", false, "all", 0 },
     {"livery",                       true,  OPTION_FUNC,   "", false, "", fgOptLivery },
     {"ai-scenario",                  true,  OPTION_FUNC,   "", false, "", fgOptScenario },
+    {"disable-ai-scenarios",         false, OPTION_FUNC,   "", false, "", fgOptNoScenarios},
     {"parking-id",                   true,  OPTION_FUNC,   "", false, "", fgOptParking  },
     {"version",                      false, OPTION_FUNC,   "", false, "", fgOptVersion },
     {"enable-fpe",                   false, OPTION_FUNC,   "", false, "", fgOptFpe},