#include <Math/fg_geodesy.hxx>
#include <Math/point3d.hxx>
#include <Math/polar3d.hxx>
+#include <Misc/fgpath.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#include <Time/event.hxx>
extern const char *default_root;
+// Read in configuration (file and command line)
+bool fgInitConfig ( int argc, char **argv ) {
+ // Attempt to locate and parse a config file
+ // First check fg_root
+ FGPath config( current_options.get_fg_root() );
+ config.append( "system.fgfsrc" );
+ current_options.parse_config_file( config.str() );
+
+ // Next check home directory
+ char* envp = ::getenv( "HOME" );
+ if ( envp != NULL ) {
+ config.set( envp );
+ config.append( ".fgfsrc" );
+ current_options.parse_config_file( config.str() );
+ }
+
+ // Parse remaining command line options
+ // These will override anything specified in a config file
+ if ( current_options.parse_command_line(argc, argv) !=
+ fgOPTIONS::FG_OPTIONS_OK )
+ {
+ // Something must have gone horribly wrong with the command
+ // line parsing or maybe the user just requested help ... :-)
+ current_options.usage();
+ FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
+ return false;
+ }
+
+ return true;
+}
+
+
// Set initial position and orientation
-int fgInitPosition( void ) {
+bool fgInitPosition( void ) {
string id;
FGInterface *f;
<< (f->get_Latitude() * RAD_TO_DEG) << ", "
<< (f->get_Altitude() * FEET_TO_METER) << ")" );
- return(1);
+ return true;
}
// General house keeping initializations
-int fgInitGeneral( void ) {
+bool fgInitGeneral( void ) {
string root;
char *mesa_win_state;
}
#endif
- return 1;
+ return true;
}
// initialization routines. If you are adding a subsystem to flight
// gear, its initialization call should located in this routine.
// Returns non-zero if a problem encountered.
-int fgInitSubsystems( void )
-{
+bool fgInitSubsystems( void ) {
FGTime::cur_time_params = new FGTime();
FGInterface *f; // assigned later
FG_LOG( FG_GENERAL, FG_INFO, endl);
- return(1);
+ return true;
}