#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/material/matlib.hxx>
#ifdef FG_USE_CLOUDS_3D
# include <simgear/sky/clouds3d/SkySceneLoader.hpp>
# include <simgear/sky/clouds3d/SkyUtil.hpp>
#include <Include/general.hxx>
#include <Input/input.hxx>
#include <Instrumentation/instrument_mgr.hxx>
-// #include <Joystick/joystick.hxx>
-#include <Objects/matlib.hxx>
#include <Model/acmodel.hxx>
#include <Navaids/fixlist.hxx>
#include <Navaids/ilslist.hxx>
#include <Scripting/scriptmgr.hxx>
#endif
#include <Sound/fg_fx.hxx>
-#include <Sound/soundmgr.hxx>
#include <Systems/system_mgr.hxx>
#include <Time/FGEventMgr.hxx>
#include <Time/light.hxx>
SG_USING_STD(string);
+
+class Sound;
+
extern const char *default_root;
#ifdef FG_USE_CLOUDS_3D
SGPropertyNode *locale = fgInitLocale(language);
if (!locale) {
- cerr << "No internationalization settings specified in preferences.xml"
- << endl;
+ SG_LOG(SG_GENERAL, SG_ALERT,
+ "No internationalization settings specified in preferences.xml" );
return false;
}
SG_LOG( SG_GENERAL, SG_INFO,
"Attempting to set starting position for "
- << id << ":" << runway );
+ << id << ":" << rwy );
if ( ! runways.search( id, rwy, &r ) ) {
SG_LOG( SG_GENERAL, SG_ALERT,
// If glideslope is specified, then calculate offset-distance or
// altitude relative to glide slope if either of those was not
// specified.
- fgSetDistOrAltFromGlideSlope();
+ if ( fgGetDouble("/sim/presets/glideslope-deg") > 0.1 ) {
+ fgSetDistOrAltFromGlideSlope();
+ }
+
+ // Select ground or air start depending on if an altitude is
+ // specified (this choice can be refined later based on other
+ // input.)
+ if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
+ fgSetBool("/sim/presets/onground", false);
+ } else {
+ fgSetBool("/sim/presets/onground", true);
+ }
// If we have an explicit, in-range lon/lat, don't change it, just use it.
// If not, check for an airport-id and use that.
if ( !set_pos && !vor.empty() ) {
// a VOR is requested
if ( fgSetPosFromNAV( vor, vor_freq ) ) {
- if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
- fgSetBool("/sim/presets/onground", false);
- } else {
- fgSetBool("/sim/presets/onground", true);
- }
set_pos = true;
}
}
if ( !set_pos && !ndb.empty() ) {
// an NDB is requested
if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
- if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
- fgSetBool("/sim/presets/onground", false);
- } else {
- fgSetBool("/sim/presets/onground", true);
- }
set_pos = true;
}
}
if ( !set_pos && !fix.empty() ) {
// a Fix is requested
if ( fgSetPosFromFix( fix ) ) {
- if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
- fgSetBool("/sim/presets/onground", false);
- } else {
- fgSetBool("/sim/presets/onground", true);
- }
set_pos = true;
}
}
static void printMat(const sgVec4 *mat, char *name="")
{
int i;
- cout << name << endl;
+ SG_LOG(SG_GENERAL, SG_BULK, name );
for(i=0; i<4; i++) {
- cout <<" "<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<endl;
+ SG_LOG(SG_GENERAL, SG_BULK, " " << mat[i][0] << " " << mat[i][1]
+ << " " << mat[i][2] << " " << mat[i][3] );
}
- cout << endl;
}
// Initialize view parameters
// gear, its initialization call should located in this routine.
// Returns non-zero if a problem encountered.
bool fgInitSubsystems() {
- static const SGPropertyNode *longitude
- = fgGetNode("/sim/presets/longitude-deg");
- static const SGPropertyNode *latitude
- = fgGetNode("/sim/presets/latitude-deg");
- static const SGPropertyNode *altitude
- = fgGetNode("/sim/presets/altitude-ft");
+ // static const SGPropertyNode *longitude
+ // = fgGetNode("/sim/presets/longitude-deg");
+ // static const SGPropertyNode *latitude
+ // = fgGetNode("/sim/presets/latitude-deg");
+ // static const SGPropertyNode *altitude
+ // = fgGetNode("/sim/presets/altitude-ft");
fgLIGHT *l = &cur_light_params;
SGPath mpath( globals->get_fg_root() );
mpath.append( "materials.xml" );
- if ( ! material_lib.load( mpath.str() ) ) {
+ if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str()) ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Error loading material lib!" );
exit(-1);
}
// Initialise the AI Manager
////////////////////////////////////////////////////////////////////
- if (fgGetBool("/sim/ai-traffic/enabled")) {
- SG_LOG(SG_GENERAL, SG_INFO, " AI Manager");
- globals->set_AI_mgr(new FGAIMgr);
- globals->get_AI_mgr()->init();
- }
+ SG_LOG(SG_GENERAL, SG_INFO, " AI Manager");
+ globals->set_AI_mgr(new FGAIMgr);
+ globals->get_AI_mgr()->init();
+
#ifdef ENABLE_AUDIO_SUPPORT
////////////////////////////////////////////////////////////////////
// Initialize the sound subsystem.
////////////////////////////////////////////////////////////////////
- globals->set_soundmgr(new FGSoundMgr);
+ globals->set_soundmgr(new SGSoundMgr);
globals->get_soundmgr()->init();
globals->get_soundmgr()->bind();
globals->get_io()->init();
globals->get_io()->bind();
- // Initialize the 2D panel.
+
+ ////////////////////////////////////////////////////////////////////
+ // Add a new 2D panel.
+ ////////////////////////////////////////////////////////////////////
+
string panel_path = fgGetString("/sim/panel/path",
"Panels/Default/default.xml");
- current_panel = fgReadPanel(panel_path);
- if (current_panel == 0) {
+
+ globals->set_current_panel( fgReadPanel(panel_path) );
+ if (globals->get_current_panel() == 0) {
SG_LOG( SG_INPUT, SG_ALERT,
"Error reading new panel from " << panel_path );
} else {
SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path );
- current_panel->init();
- current_panel->bind();
+ globals->get_current_panel()->init();
+ globals->get_current_panel()->bind();
}
void fgReInitSubsystems()
{
- static const SGPropertyNode *longitude
- = fgGetNode("/sim/presets/longitude-deg");
- static const SGPropertyNode *latitude
- = fgGetNode("/sim/presets/latitude-deg");
+ // static const SGPropertyNode *longitude
+ // = fgGetNode("/sim/presets/longitude-deg");
+ // static const SGPropertyNode *latitude
+ // = fgGetNode("/sim/presets/latitude-deg");
static const SGPropertyNode *altitude
= fgGetNode("/sim/presets/altitude-ft");
static const SGPropertyNode *master_freeze