]> git.mxchange.org Git - flightgear.git/commitdiff
Vivian MEAZZA:
authormfranz <mfranz>
Mon, 30 Jan 2006 22:08:53 +0000 (22:08 +0000)
committermfranz <mfranz>
Mon, 30 Jan 2006 22:08:53 +0000 (22:08 +0000)
"Implement the repeat function for submodels. Default value is 'false' "

src/AIModel/AIScenario.cxx
src/AIModel/submodel.cxx

index 6fd72613a78ace5a514aadc1e069af041f58e04f..3bd1d375b84c8489d3e4807b4b587f6d9258cacb 100644 (file)
@@ -76,7 +76,7 @@ FGAIScenario::FGAIScenario(const string &filename)
      en->m_class        = entry_node->getStringValue("class", "jet_transport");
      en->path           = entry_node->getStringValue("model", "Models/Geometry/glider.ac");
      en->flightplan     = entry_node->getStringValue("flightplan", "");
-     en->repeat         = entry_node->getDoubleValue("repeat", 0.0); 
+     en->repeat         = entry_node->getBoolValue("repeat", false); 
      en->latitude       = entry_node->getDoubleValue("latitude", 0.0); 
      en->longitude      = entry_node->getDoubleValue("longitude", 0.0); 
      en->altitude       = entry_node->getDoubleValue("altitude", 0.0); 
index 966927c2d0d9a8dc82547f77217622920c454513..2e3241bc69e8e6ffc2a4061b4244f2873e3fb45f 100644 (file)
@@ -108,6 +108,9 @@ FGSubmodelMgr::update (double dt)
 bool
 FGSubmodelMgr::release (submodel* sm, double dt)
 {
+  // only run if first time or repeat is set to true
+  if (!sm->first_time && !sm->repeat) return false;
+
   sm->timer += dt;
   if (sm->timer < sm->delay) return false;
   sm->timer = 0.0;
@@ -203,6 +206,7 @@ FGSubmodelMgr::load ()
  
      sm->prop = fgGetNode("/ai/submodels/submodel", i, true);
      sm->prop->tie("count", SGRawValuePointer<int>(&(sm->count)));
+     sm->prop->tie("repeat", SGRawValuePointer<bool>(&(sm->repeat)));
 
 //   sm->prop->tie("contents", SGRawValuePointer<double>(&(sm->contents)));
 //   sm->prop->tie("contents path", SGRawValuePointer<const char *>(&(sm->contents_node)));