From 2f6172687eb429a6b5fc90ed975aaaa5b9e1daeb Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 25 Sep 2012 00:48:48 +0100 Subject: [PATCH] Make FGControls behave like a standard subsystem. --- src/Aircraft/controls.cxx | 5 +++-- src/Main/fg_init.cxx | 6 ++---- src/Main/globals.cxx | 6 ------ src/Main/main.cxx | 4 ---- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/Aircraft/controls.cxx b/src/Aircraft/controls.cxx index 772ab8e74..8ff11133c 100644 --- a/src/Aircraft/controls.cxx +++ b/src/Aircraft/controls.cxx @@ -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); } - - //////////////////////////////////////////////////////////////////////// // Setters and adjusters. diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 78fc7639d..cb6b2fd6e 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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. diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 6b5dc8ce7..b126d795c 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -185,12 +185,6 @@ FGGlobals::~FGGlobals() delete ATIS_mgr; - if (controls) - { - controls->unbind(); - delete controls; - } - delete channel_options_list; delete initial_waypoints; delete scenery; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 5fd2137f8..792a20cb9 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -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 );