]> git.mxchange.org Git - flightgear.git/commitdiff
- move fgInitTowerLocationListener() from fgInitPosition() to the init
authormfranz <mfranz>
Wed, 4 Apr 2007 19:05:59 +0000 (19:05 +0000)
committermfranz <mfranz>
Wed, 4 Apr 2007 19:05:59 +0000 (19:05 +0000)
  part of fgIdleFunction() in main.cxx. fgInitPosition() is called again
  at every reset, which would every time attach another listener.

src/Main/fg_init.cxx
src/Main/fg_init.hxx
src/Main/main.cxx

index fcdc6274f877f679ed0a514dce56164893e4f112..0dba51ec4b20b70f4196626c74bb8d09030a1f76 100644 (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);
 
 
     ////////////////////////////////////////////////////////////////////
index 73a8cd7ebc330ff3d002b89b4b425848458a0c4b..5bb589d9f157a6168bc3cdfbd32a54dac092fbe6 100644 (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();
index e90777a83924fd34ffcd3d66b3cc2218f5121274..14ccc9efb5fa4b72cb501b3cc074a686ac84d730 100644 (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 );