From 3b4e5323723cc58b6ad0a13cc4452a2d1e39bef5 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 27 Apr 2006 15:30:42 +0000 Subject: [PATCH] working on the termination of the last hardcoded dialogs in Autopilot/auto_gui.cxx: - 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 | 12 ++++++++++++ src/Autopilot/route_mgr.hxx | 1 + src/Main/fg_init.cxx | 28 ---------------------------- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index d3c565e34..f94d59bde 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -30,6 +30,7 @@ #include #include
+#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::iterator it; + for (it = waypoints->begin(); it != waypoints->end(); ++it) + NewWaypoint(*it); +} + + void FGRouteMgr::bind() { } void FGRouteMgr::unbind() { } diff --git a/src/Autopilot/route_mgr.hxx b/src/Autopilot/route_mgr.hxx index da2d80249..f38ab732f 100644 --- a/src/Autopilot/route_mgr.hxx +++ b/src/Autopilot/route_mgr.hxx @@ -84,6 +84,7 @@ public: ~FGRouteMgr(); void init (); + void postinit (); void bind (); void unbind (); void update (double dt); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 4985fb3e6..0d753a321 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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::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(); -- 2.39.5