1
0
Fork 0

- move fgInitTowerLocationListener() from fgInitPosition() to the init

part of fgIdleFunction() in main.cxx. fgInitPosition() is called again
  at every reset, which would every time attach another listener.
This commit is contained in:
mfranz 2007-04-04 19:05:59 +00:00
parent b5f53c349f
commit d996d27121
3 changed files with 11 additions and 12 deletions

View file

@ -693,7 +693,7 @@ struct FGTowerLocationListener : SGPropertyChangeListener {
}
};
static void fgInitTowerLocationListener() {
void fgInitTowerLocationListener() {
fgGetNode("/sim/tower/airport-id", true)
->addChangeListener( new FGTowerLocationListener() );
}
@ -1147,7 +1147,6 @@ bool fgInitPosition() {
string fix = fgGetString("/sim/presets/fix");
fgSetDouble( "/orientation/heading-deg", hdg );
fgInitTowerLocationListener();
if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
// An airport + runway is requested
@ -1695,16 +1694,10 @@ bool fgInitSubsystems() {
globals->add_subsystem("submodel_mgr", new FGSubmodelMgr);
// It's probably a good idea to initialize the top level traffic manager
// After the AI and ATC systems have been initialized properly.
// AI Traffic manager
globals->add_subsystem("Traffic Manager", new FGTrafficManager);
//FGTrafficManager *dispatcher =
// (FGTrafficManager*) globals->get_subsystem("Traffic Manager");
//SGPath path = globals->get_fg_root();
//path.append("/Traffic/fgtraffic.xml");
//readXML(path.str(),
// *dispatcher);
// It's probably a good idea to initialize the top level traffic manager
// After the AI and ATC systems have been initialized properly.
// AI Traffic manager
globals->add_subsystem("Traffic Manager", new FGTrafficManager);
////////////////////////////////////////////////////////////////////

View file

@ -83,6 +83,11 @@ void fgReInitSubsystems();
// Set the initial position based on presets (or defaults)
bool fgInitPosition();
// Listen to /sim/tower/airport-id and set tower view position accordingly
void fgInitTowerLocationListener();
// Initialize various time dependent systems (lighting, sun position, etc.)
// returns a new instance of the SGTime class
SGTime *fgInitTime();

View file

@ -698,6 +698,7 @@ static void fgIdleFunction ( void ) {
// based on the requested presets, calculate the true starting
// lon, lat
fgInitPosition();
fgInitTowerLocationListener();
SGTime *t = fgInitTime();
globals->set_time_params( t );