1
0
Fork 0

Remove current_aircraft global, fgAIRCRAFT struct, and dead code for reading aircraft dirs.

This commit is contained in:
James Turner 2010-07-01 22:33:51 +01:00
parent 3f26d2b14b
commit 01e0156b5d
23 changed files with 16 additions and 110 deletions

View file

@ -48,43 +48,6 @@
#include "aircraft.hxx" #include "aircraft.hxx"
// This is a record containing all the info for the aircraft currently
// being operated
fgAIRCRAFT current_aircraft;
// Initialize an Aircraft structure
void fgAircraftInit( void ) {
SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" );
current_aircraft.controls = globals->get_controls();
}
// Display various parameters to stdout
void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
FlightProperties f;
SG_LOG( SG_FLIGHT, SG_DEBUG,
"Pos = ("
<< (f.get_Longitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
<< (f.get_Latitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
<< f.get_Altitude()
<< ") (Phi,Theta,Psi)=("
<< f.get_Phi() << ","
<< f.get_Theta() << ","
<< f.get_Psi() << ")" );
SG_LOG( SG_FLIGHT, SG_DEBUG,
"Kts = " << f.get_V_equiv_kts()
<< " 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 ) );
}
// Show available aircraft types // Show available aircraft types
void fgReadAircraft(void) { void fgReadAircraft(void) {
@ -137,7 +100,7 @@ void fgReadAircraft(void) {
ulCloseDir(dirp); ulCloseDir(dirp);
globals->get_commands()->addCommand("load-aircraft", fgLoadAircraft);
} }
bool bool
@ -212,7 +175,7 @@ fgLoadAircraft (const SGPropertyNode * arg)
fgInitPosition(); fgInitPosition();
// Update the HUD // Update the HUD
fgHUDInit(&current_aircraft); fgHUDInit();
SGTime *t = globals->get_time_params(); SGTime *t = globals->get_time_params();
delete t; delete t;

View file

@ -26,30 +26,8 @@
#ifndef _AIRCRAFT_HXX #ifndef _AIRCRAFT_HXX
#define _AIRCRAFT_HXX #define _AIRCRAFT_HXX
class FGControls;
class SGPropertyNode; class SGPropertyNode;
// Define a structure containing all the parameters for an aircraft
typedef struct{
FGControls *controls;
} fgAIRCRAFT ;
// current_aircraft contains all the parameters of the aircraft
// currently being operated.
extern fgAIRCRAFT current_aircraft;
// Initialize an Aircraft structure
void fgAircraftInit( void );
// Display various parameters to stdout
void fgAircraftOutputCurrent(fgAIRCRAFT *a);
// Read the list of available aircraft into to property tree
void fgReadAircraft(void);
bool fgLoadAircraft (const SGPropertyNode * arg); bool fgLoadAircraft (const SGPropertyNode * arg);
#endif // _AIRCRAFT_HXX #endif // _AIRCRAFT_HXX

View file

@ -36,7 +36,6 @@
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
@ -360,7 +359,7 @@ float get_aux18 (void)
#endif #endif
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft ) bool fgCockpitInit()
{ {
SG_LOG( SG_COCKPIT, SG_INFO, "Initializing cockpit subsystem" ); SG_LOG( SG_COCKPIT, SG_INFO, "Initializing cockpit subsystem" );
@ -376,7 +375,7 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
// HI_Head is now a null pointer so we can generate a new list from the // HI_Head is now a null pointer so we can generate a new list from the
// current aircraft. // current aircraft.
fgHUDInit( cur_aircraft ); fgHUDInit();
return true; return true;
} }

View file

@ -33,10 +33,7 @@
#include <osg/State> #include <osg/State>
#include <Aircraft/aircraft.hxx> bool fgCockpitInit();
#include "panel.hxx"
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft );
void fgCockpitUpdate( osg::State* ); void fgCockpitUpdate( osg::State* );
#endif /* _COCKPIT_HXX */ #endif /* _COCKPIT_HXX */

View file

@ -42,8 +42,6 @@
#include <osg/GLU> #include <osg/GLU>
#include <Aircraft/aircraft.hxx>
//#include <Autopilot/xmlauto.hxx>
#include <GUI/new_gui.hxx> // FGFontCache #include <GUI/new_gui.hxx> // FGFontCache
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
@ -230,7 +228,7 @@ int readHud( istream &input )
// display for a Piper Cub doesn't show the speed range of a North American // display for a Piper Cub doesn't show the speed range of a North American
// mustange and the engine readouts of a B36! // mustange and the engine readouts of a B36!
// //
int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ ) int fgHUDInit()
{ {
HUD_style = 1; HUD_style = 1;
@ -282,7 +280,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
} }
int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ) int fgHUDInit2()
{ {
HUD_style = 2; HUD_style = 2;

View file

@ -54,7 +54,6 @@ namespace osg {
#include <simgear/constants.h> #include <simgear/constants.h>
#include <Include/fg_typedefs.h> #include <Include/fg_typedefs.h>
#include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx> #include <Aircraft/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
@ -694,8 +693,8 @@ public:
}; };
extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ ); extern int fgHUDInit();
extern int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ); extern int fgHUDInit2();
extern void fgUpdateHUD( osg::State* ); extern void fgUpdateHUD( osg::State* );
extern void fgUpdateHUD( osg::State*, GLfloat x_start, GLfloat y_start, extern void fgUpdateHUD( osg::State*, GLfloat x_start, GLfloat y_start,
GLfloat x_end, GLfloat y_end ); GLfloat x_end, GLfloat y_end );

View file

@ -27,7 +27,6 @@
#include <math.h> #include <math.h>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Aircraft/aircraft.hxx>
#include <Environment/environment.hxx> #include <Environment/environment.hxx>
#include <Environment/environment_mgr.hxx> #include <Environment/environment_mgr.hxx>
#include <ATCDCL/ATCutils.hxx> #include <ATCDCL/ATCutils.hxx>

View file

@ -32,7 +32,6 @@
#include <Main/main.hxx> #include <Main/main.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Aircraft/aircraft.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include "environment.hxx" #include "environment.hxx"

View file

@ -38,7 +38,6 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx> #include <Aircraft/controls.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -38,7 +38,6 @@ INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#undef MAX_ENGINES #undef MAX_ENGINES
#include <Aircraft/aircraft.hxx>
#include "math/FGColumnVector3.h" #include "math/FGColumnVector3.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -31,7 +31,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/scene/model/placement.hxx> #include <simgear/scene/model/placement.hxx>
#include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx> #include <Aircraft/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <FDM/UIUCModel/uiuc_aircraft.h> #include <FDM/UIUCModel/uiuc_aircraft.h>

View file

@ -48,8 +48,6 @@ HISTORY
#include <simgear/constants.h> #include <simgear/constants.h>
#include <Aircraft/aircraft.hxx>
#include "BalloonSim.h" #include "BalloonSim.h"
/****************************************************************************/ /****************************************************************************/

View file

@ -67,7 +67,6 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "uiuc_gear.h" #include "uiuc_gear.h"

View file

@ -94,7 +94,6 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "uiuc_recorder.h" #include "uiuc_recorder.h"

View file

@ -86,7 +86,6 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"

View file

@ -29,7 +29,6 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx> #include <Aircraft/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Environment/environment.hxx> #include <Environment/environment.hxx>

View file

@ -32,7 +32,6 @@
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <Aircraft/aircraft.hxx>
#include <Navaids/navlist.hxx> #include <Navaids/navlist.hxx>
#include "kr_87.hxx" #include "kr_87.hxx"

View file

@ -32,8 +32,6 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <Aircraft/aircraft.hxx>
#include "kt_70.hxx" #include "kt_70.hxx"

View file

@ -1315,14 +1315,14 @@ do_increase_visibility (const SGPropertyNode * arg)
static bool static bool
do_hud_init(const SGPropertyNode *) do_hud_init(const SGPropertyNode *)
{ {
fgHUDInit(0); // minimal HUD fgHUDInit(); // minimal HUD
return true; return true;
} }
static bool static bool
do_hud_init2(const SGPropertyNode *) do_hud_init2(const SGPropertyNode *)
{ {
fgHUDInit2(0); // normal HUD fgHUDInit2(); // normal HUD
return true; return true;
} }

View file

@ -64,7 +64,6 @@
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <simgear/timing/lowleveltime.h> #include <simgear/timing/lowleveltime.h>
#include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx> #include <Aircraft/controls.hxx>
#include <Aircraft/replay.hxx> #include <Aircraft/replay.hxx>
#include <Airports/apt_loader.hxx> #include <Airports/apt_loader.hxx>
@ -1407,11 +1406,6 @@ bool fgInitSubsystems() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM); globals->add_subsystem("flight", new FDMShell, SGSubsystemMgr::FDM);
// allocates structures so must happen before any of the flight
// model or control parameters are set
fgAircraftInit(); // In the future this might not be the case.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Initialize the weather subsystem. // Initialize the weather subsystem.
@ -1525,10 +1519,7 @@ bool fgInitSubsystems() {
globals->add_subsystem("Traffic Manager", new FGTrafficManager); globals->add_subsystem("Traffic Manager", new FGTrafficManager);
//////////////////////////////////////////////////////////////////// if( fgCockpitInit()) {
// Initialize the cockpit subsystem
////////////////////////////////////////////////////////////////////
if( fgCockpitInit( &current_aircraft )) {
// Cockpit initialized ok. // Cockpit initialized ok.
} else { } else {
SG_LOG( SG_GENERAL, SG_ALERT, "Error in Cockpit initialization!" ); SG_LOG( SG_GENERAL, SG_ALERT, "Error in Cockpit initialization!" );
@ -1641,10 +1632,6 @@ void fgReInitSubsystems()
// Initialize the FDM // Initialize the FDM
globals->get_subsystem("flight")->reinit(); globals->get_subsystem("flight")->reinit();
// allocates structures so must happen before any of the flight
// model or control parameters are set
fgAircraftInit(); // In the future this might not be the case.
// reload offsets from config defaults // reload offsets from config defaults
globals->get_viewmgr()->reinit(); globals->get_viewmgr()->reinit();

View file

@ -54,6 +54,7 @@
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Aircraft/replay.hxx> #include <Aircraft/replay.hxx>
#include <Aircraft/aircraft.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>
#include <Model/panelnode.hxx> #include <Model/panelnode.hxx>
@ -535,8 +536,9 @@ static void fgIdleFunction ( void ) {
} else if ( idle_state == 2 ) { } else if ( idle_state == 2 ) {
idle_state++; idle_state++;
// Read the list of available aircraft
fgReadAircraft(); globals->get_commands()->addCommand("load-aircraft", fgLoadAircraft);
fgSplashProgress("reading airport & navigation data"); fgSplashProgress("reading airport & navigation data");
@ -725,7 +727,6 @@ static void fgIdleFunction ( void ) {
// setup OpenGL view parameters // setup OpenGL view parameters
globals->get_renderer()->init(); globals->get_renderer()->init();
SG_LOG( SG_GENERAL, SG_INFO, "Panel visible = " << fgPanelVisible() );
globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"), globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"),
fgGetInt("/sim/startup/ysize") ); fgGetInt("/sim/startup/ysize") );

View file

@ -80,7 +80,6 @@
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Aircraft/aircraft.hxx>
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>

View file

@ -29,7 +29,6 @@
#include <simgear/io/iochannel.hxx> #include <simgear/io/iochannel.hxx>
#include <simgear/misc/stdint.hxx> #include <simgear/misc/stdint.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "jsclient.hxx" #include "jsclient.hxx"