getPanelVisible, setPanelVisible);
// Position
+ current_properties.tieString("/position/airport-id",
+ getTargetAirport, setTargetAirport);
current_properties.tieDouble("/position/latitude",
getLatitude, setLatitude);
current_properties.tieDouble("/position/longitude",
/**
* Get the GPS target airport code.
*/
-const string
+const string &
FGBFI::getTargetAirport ()
{
- return current_options.get_airport_id();
+ // FIXME: not thread-safe
+ static string out;
+ out = current_options.get_airport_id();
+
+ return out;
}
void
FGBFI::setTargetAirport (const string &airportId)
{
+ // cout << "setting target airport id = " << airportId << endl;
current_options.set_airport_id(airportId);
}
static void setADFRotation (double rot);
// GPS
- static const string getTargetAirport ();
+ static const string &getTargetAirport ();
static bool getGPSLock ();
static double getGPSTargetLatitude ();
static double getGPSTargetLongitude ();
#include "save.hxx"
#include "views.hxx"
+ // From main.cxx
+extern void fgReshape( int width, int height );
+
// Handle keyboard events
void GLUTkey(unsigned char k, int x, int y) {
}
return;
}
+ case GLUT_KEY_F5: {
+ current_panel->setYOffset(current_panel->getYOffset() - 5);
+ fgReshape(current_view.get_winWidth(),
+ current_view.get_winHeight());
+ return;
+ }
+ case GLUT_KEY_F6: {
+ current_panel->setYOffset(current_panel->getYOffset() + 5);
+ fgReshape(current_view.get_winWidth(),
+ current_view.get_winHeight());
+ return;
+ }
+ case GLUT_KEY_F7: {
+ current_panel->setXOffset(current_panel->getXOffset() - 5);
+ return;
+ }
+ case GLUT_KEY_F8: {
+ current_panel->setXOffset(current_panel->getXOffset() + 5);
+ return;
+ }
case GLUT_KEY_END: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
return;
// fg_root was specified (ignore all other options for now)
fgInitFGRoot(argc, argv);
+ // cout << "1. airport_id = " << current_options.get_airport_id() << endl;
+
// Read global preferences from $FG_ROOT/preferences.xml
FGPath props_path(current_options.get_fg_root());
props_path.append("preferences.xml");
FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
}
+ // cout << "2. airport_id = " << current_options.get_airport_id() << endl;
+
// Initialize the Aircraft directory to "" (UIUC)
aircraft_dir = "";
guiInit();
// set current_options lon/lat if an airport id is specified
+ // cout << "3. airport_id = " << current_options.get_airport_id() << endl;
if ( current_options.get_airport_id().length() ) {
// fgSetPosFromAirportID( current_options.get_airport_id() );
fgSetPosFromAirportIDandHdg( current_options.get_airport_id(),
fg_scenery = "";
}
- airport_id = "P13"; // default airport id
+ airport_id = "KPAO"; // default airport id
net_id = "Johnney"; // default pilot's name
// initialize port config string list
sound = true;
} else if ( arg.find( "--airport-id=") != string::npos ) {
airport_id = arg.substr( 13 );
+ current_properties.setStringValue("/position/airport-id", airport_id);
} else if ( arg.find( "--lon=" ) != string::npos ) {
lon = parse_degree( arg.substr(6) );
airport_id = "";
current_properties.setDoubleValue("/position/longitude", lon);
+ current_properties.setStringValue("/position/airport-id", airport_id);
} else if ( arg.find( "--lat=" ) != string::npos ) {
lat = parse_degree( arg.substr(6) );
airport_id = "";
current_properties.setDoubleValue("/position/latitude", lat);
+ current_properties.setStringValue("/position/airport-id", airport_id);
} else if ( arg.find( "--altitude=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
altitude = atof( arg.substr(11) ) * FEET_TO_METER;