]> git.mxchange.org Git - flightgear.git/commitdiff
Make FGControls behave like a standard subsystem.
authorJames Turner <zakalawe@mac.com>
Mon, 24 Sep 2012 23:48:48 +0000 (00:48 +0100)
committerJames Turner <zakalawe@mac.com>
Mon, 24 Sep 2012 23:48:48 +0000 (00:48 +0100)
src/Aircraft/controls.cxx
src/Main/fg_init.cxx
src/Main/globals.cxx
src/Main/main.cxx

index 772ab8e74942bfe75d27969e968560da920fe4a5..8ff11133c2dce0c58af67b7c1255489ce3509e91 100644 (file)
@@ -100,6 +100,7 @@ FGControls::FGControls() :
     vertical_mode( 0 ),
     lateral_mode( 0 )
 {
+    globals->set_controls( this );
 }
 
 
@@ -231,6 +232,7 @@ static inline void _SetRoot( simgear::TiedPropertyList & tiedProperties, const c
 void
 FGControls::bind ()
 {
+    init(); // unfortunately, tie-ing requires init() to have occurred
     int index, i;
 
     // flight controls
@@ -648,9 +650,8 @@ void FGControls::unbind ()
 void
 FGControls::update (double dt)
 {
+  SG_UNUSED(dt);
 }
-
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // Setters and adjusters.
index 78fc7639d182693f77965ca194d1fa8927077c16..cb6b2fd6e8cdddaa4cce3ab06647e80bfa72a350 100644 (file)
@@ -677,10 +677,8 @@ void fgCreateSubsystems() {
     ////////////////////////////////////////////////////////////////////
     // Initialize the controls subsystem.
     ////////////////////////////////////////////////////////////////////
-
-    globals->get_controls()->init();
-    globals->get_controls()->bind();
-
+    
+    globals->add_subsystem("controls", new FGControls);
 
     ////////////////////////////////////////////////////////////////////
     // Initialize the input subsystem.
index 6b5dc8ce77f5c25ca94390952dba257bde0277bd..b126d795c1d33f565c4c48f09d0e4a2c0feab6f8 100644 (file)
@@ -185,12 +185,6 @@ FGGlobals::~FGGlobals()
 
     delete ATIS_mgr;
 
-    if (controls)
-    {
-        controls->unbind();
-        delete controls;
-    }
-
     delete channel_options_list;
     delete initial_waypoints;
     delete scenery;
index 5fd2137f8bc2c8262887a1420d0afdbb9bf532f5..792a20cb98416de085feff55417d10aeda18e043 100644 (file)
@@ -49,7 +49,6 @@
 #include <simgear/math/SGMath.hxx>
 #include <simgear/math/sg_random.h>
 
-#include <Aircraft/controls.hxx>
 #include <Model/panelnode.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
@@ -364,9 +363,6 @@ int fgMainInit( int argc, char **argv ) {
     // seed the random number generator
     sg_srandom_time();
 
-    FGControls *controls = new FGControls;
-    globals->set_controls( controls );
-
     string_list *col = new string_list;
     globals->set_channel_options_list( col );