]> git.mxchange.org Git - flightgear.git/commitdiff
working on the termination of the last hardcoded dialogs in Autopilot/auto_gui.cxx:
authormfranz <mfranz>
Thu, 27 Apr 2006 15:30:42 +0000 (15:30 +0000)
committermfranz <mfranz>
Thu, 27 Apr 2006 15:30:42 +0000 (15:30 +0000)
- move fg_init/parseWaypoints() to route_mgr/postinit()
- don't delete initial string list to keep it available for subsystem reinit

src/Autopilot/route_mgr.cxx
src/Autopilot/route_mgr.hxx
src/Main/fg_init.cxx

index d3c565e34b7f716ffcf0fb775f2e7ea90b586130..f94d59bde6dd3dba46187358e2985504a57d97a5 100644 (file)
@@ -30,6 +30,7 @@
 #include <FDM/flight.hxx>
 #include <Main/fg_props.hxx>
 
+#include "auto_gui.hxx"        // FIXME temporary dependency (NewWaypoint)
 #include "route_mgr.hxx"
 
 
@@ -80,6 +81,17 @@ void FGRouteMgr::init() {
 }
 
 
+void FGRouteMgr::postinit() {
+    string_list *waypoints = globals->get_initial_waypoints();
+    if (!waypoints)
+        return;
+
+    vector<string>::iterator it;
+    for (it = waypoints->begin(); it != waypoints->end(); ++it)
+        NewWaypoint(*it);
+}
+
+
 void FGRouteMgr::bind() { }
 void FGRouteMgr::unbind() { }
 
index da2d80249f2fe76fd35193f1ea4d41c2ee144d35..f38ab732fca3d96f82d1b72757af67451395e240 100644 (file)
@@ -84,6 +84,7 @@ public:
     ~FGRouteMgr();
 
     void init ();
+    void postinit ();
     void bind ();
     void unbind ();
     void update (double dt);
index 4985fb3e64b378bf111374681878744f95e143be..0d753a321d87af130007bbb19a9c4e11df062848 100644 (file)
@@ -1021,29 +1021,6 @@ static bool fgSetPosFromFix( const string& id ) {
         return false;
     }
 }
-static void parseWaypoints() {
-    string_list *waypoints = globals->get_initial_waypoints();
-    if (waypoints) {
-       vector<string>::iterator i;
-       for (i = waypoints->begin(); 
-            i  != waypoints->end();
-            i++)
-        {
-            NewWaypoint(*i);
-        }
-       // Now were done using the way points we can deallocate the
-       // memory they used
-       while (waypoints->begin() != waypoints->end()) {
-            waypoints->pop_back();
-        }
-       delete waypoints;
-       globals->set_initial_waypoints(0);
-    }
-}
-
 
 
 /**
@@ -1817,11 +1794,6 @@ bool fgInitSubsystems() {
     globals->add_subsystem("nasal", nasal);
     nasal->init();
 
-    ////////////////////////////////////////////////////////////////////
-    // At this point we could try and parse the waypoint options
-    ///////////////////////////////////////////////////////////////////
-    parseWaypoints();
-
     // initialize methods that depend on other subsystems.
     globals->get_subsystem_mgr()->postinit();