From 96b88e539f769c0e0d70d112d7f98f6843760e10 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 22 Jul 2001 19:51:16 +0000 Subject: [PATCH] Move FGControls declaration to globals.hxx --- src/Aircraft/aircraft.cxx | 12 +++++++----- src/Autopilot/newauto.cxx | 29 +++++++++++++++-------------- src/Cockpit/cockpit.cxx | 11 ++++++----- src/Cockpit/hud.cxx | 1 + src/Cockpit/panel.cxx | 1 + src/Cockpit/steam.cxx | 2 +- src/Controls/controls.cxx | 3 --- src/Controls/controls.hxx | 4 +--- src/FDM/ADA.cxx | 9 +++++---- src/FDM/Balloon.cxx | 2 +- src/FDM/JSBSim.cxx | 32 ++++++++++++++++---------------- src/FDM/LaRCsim.cxx | 26 ++++++++++++++------------ src/FDM/MagicCarpet.cxx | 6 +++--- src/GUI/gui.cxx | 1 + src/GUI/mouse.cxx | 20 +++++++++----------- src/Main/fg_commands.cxx | 1 + src/Main/fg_init.cxx | 7 ++++--- src/Main/fg_props.cxx | 13 +++++++------ src/Main/globals.hxx | 17 +++++++++++++++-- src/Main/main.cxx | 11 ++++++++--- src/Main/options.cxx | 1 + src/Network/Makefile.am | 2 ++ src/Network/joyclient.cxx | 8 ++++---- src/NetworkOLK/net_send.cxx | 1 + src/Scenery/hitlist.cxx | 1 + src/Scenery/newcache.cxx | 1 + src/Scenery/tileentry.cxx | 1 + src/Scenery/tilemgr.cxx | 1 + src/Time/light.cxx | 1 + src/Time/moonpos.cxx | 5 +++-- src/Time/sunpos.cxx | 5 +++-- 31 files changed, 135 insertions(+), 100 deletions(-) diff --git a/src/Aircraft/aircraft.cxx b/src/Aircraft/aircraft.cxx index 08bcaf8da..886cc149d 100644 --- a/src/Aircraft/aircraft.cxx +++ b/src/Aircraft/aircraft.cxx @@ -26,6 +26,8 @@ #include #include +#include
+ #include "aircraft.hxx" // This is a record containing all the info for the aircraft currently @@ -38,7 +40,7 @@ void fgAircraftInit( void ) { SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" ); current_aircraft.fdm_state = cur_fdm_state; - current_aircraft.controls = &controls; + current_aircraft.controls = globals->get_controls(); } @@ -60,10 +62,10 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) { SG_LOG( SG_FLIGHT, SG_DEBUG, "Kts = " << f->get_V_equiv_kts() - << " Elev = " << controls.get_elevator() - << " Aileron = " << controls.get_aileron() - << " Rudder = " << controls.get_rudder() - << " Power = " << controls.get_throttle( 0 ) ); + << " Elev = " << globals->get_controls()->get_elevator() + << " Aileron = " << globals->get_controls()->get_aileron() + << " Rudder = " << globals->get_controls()->get_rudder() + << " Power = " << globals->get_controls()->get_throttle( 0 ) ); } diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index 2198459c3..2d27bf059 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -207,10 +207,10 @@ void FGAutopilot::MakeTargetWPStr( double distance ) { void FGAutopilot::update_old_control_values() { - old_aileron = controls.get_aileron(); - old_elevator = controls.get_elevator(); - old_elevator_trim = controls.get_elevator_trim(); - old_rudder = controls.get_rudder(); + old_aileron = globals->get_controls()->get_aileron(); + old_elevator = globals->get_controls()->get_elevator(); + old_elevator_trim = globals->get_controls()->get_elevator_trim(); + old_rudder = globals->get_controls()->get_rudder(); } @@ -514,8 +514,8 @@ int FGAutopilot::run() { double AileronSet = -turn / 2.0; if ( AileronSet < -1.0 ) { AileronSet = -1.0; } if ( AileronSet > 1.0 ) { AileronSet = 1.0; } - controls.set_aileron( AileronSet ); - controls.set_rudder( AileronSet / 4.0 ); + globals->get_controls()->set_aileron( AileronSet ); + globals->get_controls()->set_rudder( AileronSet / 4.0 ); } else { // steer towards the target heading @@ -580,8 +580,8 @@ int FGAutopilot::run() { MaxAileron ); } - controls.set_aileron( AileronSet ); - controls.set_rudder( AileronSet / 4.0 ); + globals->get_controls()->set_aileron( AileronSet ); + globals->get_controls()->set_rudder( AileronSet / 4.0 ); // controls.set_rudder( 0.0 ); } } @@ -698,7 +698,7 @@ int FGAutopilot::run() { total_adj = -1.0; } - controls.set_elevator( total_adj ); + globals->get_controls()->set_elevator( total_adj ); } // auto throttle @@ -737,7 +737,8 @@ int FGAutopilot::run() { total_adj = 0.0; } - controls.set_throttle( FGControls::ALL_ENGINES, total_adj ); + globals->get_controls()->set_throttle( FGControls::ALL_ENGINES, + total_adj ); } #ifdef THIS_CODE_IS_NOT_USED @@ -769,10 +770,10 @@ int FGAutopilot::run() { // stash this runs control settings // update_old_control_values(); - old_aileron = controls.get_aileron(); - old_elevator = controls.get_elevator(); - old_elevator_trim = controls.get_elevator_trim(); - old_rudder = controls.get_rudder(); + old_aileron = globals->get_controls()->get_aileron(); + old_elevator = globals->get_controls()->get_elevator(); + old_elevator_trim = globals->get_controls()->get_elevator_trim(); + old_rudder = globals->get_controls()->get_rudder(); // for cross track error old_lat = lat; diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 79b071802..f8e822b3f 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -45,6 +45,7 @@ #include #include
#include
+#include
#include #include