]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/modelmgr.cxx
Make sure that all elapsed time gets passed to update when a subsystem
[flightgear.git] / src / Model / modelmgr.cxx
index ce15e6078c6b1a85ad659e98ca077d071cc92803..29693ecf1e11ef2218fa28c2966cbcf99242733e 100644 (file)
@@ -83,7 +83,7 @@ FGModelMgr::init ()
     globals->get_scenery()->get_scene_graph()->addKid(model->getSceneGraph());
 
                                // Save this instance for updating
-    _instances.push_back(instance);
+    add_instance(instance);
   }
 }
 
@@ -120,10 +120,29 @@ FGModelMgr::update (double dt)
     if (instance->heading_deg_node != 0)
       model->setHeadingDeg(instance->heading_deg_node->getDoubleValue());
 
-    instance->model->update(dt);
+    instance->model->update();
   }
 }
 
+void
+FGModelMgr::add_instance (Instance * instance)
+{
+    _instances.push_back(instance);
+}
+
+void
+FGModelMgr::remove_instance (Instance * instance)
+{
+    vector<Instance *>::iterator it;
+    for (it = _instances.begin(); it != _instances.end(); it++) {
+        if (*it == instance) {
+            _instances.erase(it);
+            delete instance;
+            return;
+        }
+    }
+}
+
 void
 FGModelMgr::draw ()
 {