- 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:
parent
b5f53c349f
commit
d996d27121
3 changed files with 11 additions and 12 deletions
|
@ -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
|
||||
|
@ -1699,12 +1698,6 @@ bool fgInitSubsystems() {
|
|||
// 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);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue