From cde90e06d576ec5c563cedcf5a7232df33496c8c Mon Sep 17 00:00:00 2001 From: david Date: Tue, 9 Apr 2002 18:58:24 +0000 Subject: [PATCH] Removed current_model global variable and added a reference in FGGlobals instead (we still need to do the same with current_input and a few other globals). --- src/Main/fg_init.cxx | 20 +++++++++++--------- src/Main/globals.hxx | 10 ++++++++++ src/Main/main.cxx | 5 +---- src/Model/acmodel.cxx | 2 -- src/Model/acmodel.hxx | 2 -- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index deace4519..dd67485a7 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -95,6 +95,7 @@ #include // #include #include +#include #include #include #include @@ -789,6 +790,7 @@ bool fgInitSubsystems( void ) { globals->get_logger()->init(); globals->get_logger()->bind(); + //////////////////////////////////////////////////////////////////// // Initialize the local time subsystem. //////////////////////////////////////////////////////////////////// @@ -968,15 +970,6 @@ bool fgInitSubsystems( void ) { } - //////////////////////////////////////////////////////////////////// - // Initialize the joystick subsystem. - //////////////////////////////////////////////////////////////////// - - // if ( ! fgJoystickInit() ) { - // SG_LOG( SG_GENERAL, SG_ALERT, "Error in Joystick initialization!" ); - // } - - //////////////////////////////////////////////////////////////////// // Initialize the autopilot subsystem. //////////////////////////////////////////////////////////////////// @@ -1037,6 +1030,15 @@ bool fgInitSubsystems( void ) { current_input.bind(); + //////////////////////////////////////////////////////////////////// + // Initialize the 3D aircraft model subsystem. + //////////////////////////////////////////////////////////////////// + + globals->set_aircraft_model(new FGAircraftModel); + globals->get_aircraft_model()->init(); + globals->get_aircraft_model()->bind(); + + //////////////////////////////////////////////////////////////////////// // End of subsystem initialization. //////////////////////////////////////////////////////////////////// diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 0ec5980b9..7a4899fe2 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -64,6 +64,7 @@ class FGViewer; class FGATCMgr; class FGATCDisplay; class FGAIMgr; +class FGAircraftModel; /** @@ -149,6 +150,8 @@ private: SGCommandMgr *commands; + FGAircraftModel *acmodel; + // list of serial port-like configurations string_list *channel_options_list; @@ -241,6 +244,13 @@ public: inline SGCommandMgr *get_commands () { return commands; } + inline FGAircraftModel *get_aircraft_model () { return acmodel; } + + inline void set_aircraft_model (FGAircraftModel * model) + { + acmodel = model; + } + inline string_list *get_channel_options_list () { return channel_options_list; } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index ef3071dc8..bb3175380 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -614,7 +614,7 @@ void fgRenderFrame( void ) { ssgSetNearFar( scene_nearplane, scene_farplane ); - current_model.update(dt_ms); + globals->get_aircraft_model()->update(dt_ms); // $$$ begin - added VS Renganthan 17 Oct 2K if(objc) @@ -1569,9 +1569,6 @@ int mainLoop( int argc, char **argv ) { fgLoadDCS(); // ADA - // temporary visible aircraft "own ship" - current_model.init(); - #ifdef FG_NETWORK_OLK // Do the network intialization if ( fgGetBool("/sim/networking/network-olk") ) { diff --git a/src/Model/acmodel.cxx b/src/Model/acmodel.cxx index ece3d5076..63cacf89f 100644 --- a/src/Model/acmodel.cxx +++ b/src/Model/acmodel.cxx @@ -24,8 +24,6 @@ extern ssgRoot * cockpit; // FIXME: from main.cxx -FGAircraftModel current_model; // FIXME: add to globals - //////////////////////////////////////////////////////////////////////// diff --git a/src/Model/acmodel.hxx b/src/Model/acmodel.hxx index 920fbbdc4..22401df61 100644 --- a/src/Model/acmodel.hxx +++ b/src/Model/acmodel.hxx @@ -40,7 +40,5 @@ private: }; -extern FGAircraftModel current_model; - #endif // __ACMODEL_HXX -- 2.39.5