Merge branch 'refs/heads/topics/loadfp' into next
This commit is contained in:
commit
5bae2e3d37
2 changed files with 16 additions and 57 deletions
src
|
@ -224,6 +224,15 @@ void FGRouteMgr::init() {
|
||||||
|
|
||||||
void FGRouteMgr::postinit()
|
void FGRouteMgr::postinit()
|
||||||
{
|
{
|
||||||
|
SGPath path(_pathNode->getStringValue());
|
||||||
|
if (path.exists()) {
|
||||||
|
SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from:" << path.str());
|
||||||
|
loadRoute();
|
||||||
|
}
|
||||||
|
|
||||||
|
// this code only matters for the --wp option now - perhaps the option
|
||||||
|
// should be deprecated in favour of an explicit flight-plan file?
|
||||||
|
// then the global initial waypoint list could die.
|
||||||
string_list *waypoints = globals->get_initial_waypoints();
|
string_list *waypoints = globals->get_initial_waypoints();
|
||||||
if (waypoints) {
|
if (waypoints) {
|
||||||
string_list::iterator it;
|
string_list::iterator it;
|
||||||
|
|
|
@ -555,54 +555,6 @@ add_channel( const string& type, const string& channel_str ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// The parse wp and parse flight-plan options don't work anymore, because
|
|
||||||
// the route manager and the airport subsystems have not yet been initialized
|
|
||||||
// at this stage.
|
|
||||||
|
|
||||||
// Parse --wp=ID[@alt]
|
|
||||||
static void
|
|
||||||
parse_wp( const string& arg ) {
|
|
||||||
string_list *waypoints = globals->get_initial_waypoints();
|
|
||||||
if (!waypoints) {
|
|
||||||
waypoints = new string_list;
|
|
||||||
globals->set_initial_waypoints(waypoints);
|
|
||||||
}
|
|
||||||
waypoints->push_back(arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Parse --flight-plan=[file]
|
|
||||||
static bool
|
|
||||||
parse_flightplan(const string& arg)
|
|
||||||
{
|
|
||||||
string_list *waypoints = globals->get_initial_waypoints();
|
|
||||||
if (!waypoints) {
|
|
||||||
waypoints = new string_list;
|
|
||||||
globals->set_initial_waypoints(waypoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
sg_gzifstream in(arg.c_str());
|
|
||||||
if ( !in.is_open() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
while ( true ) {
|
|
||||||
string line;
|
|
||||||
getline( in, line, '\n' );
|
|
||||||
|
|
||||||
// catch extraneous (DOS) line ending character
|
|
||||||
if ( line[line.length() - 1] < 32 )
|
|
||||||
line = line.substr( 0, line.length()-1 );
|
|
||||||
|
|
||||||
if ( in.eof() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
waypoints->push_back(line);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fgOptLanguage( const char *arg )
|
fgOptLanguage( const char *arg )
|
||||||
{
|
{
|
||||||
|
@ -1067,14 +1019,12 @@ fgOptCeiling( const char *arg )
|
||||||
static int
|
static int
|
||||||
fgOptWp( const char *arg )
|
fgOptWp( const char *arg )
|
||||||
{
|
{
|
||||||
parse_wp( arg );
|
string_list *waypoints = globals->get_initial_waypoints();
|
||||||
return FG_OPTIONS_OK;
|
if (!waypoints) {
|
||||||
}
|
waypoints = new string_list;
|
||||||
|
globals->set_initial_waypoints(waypoints);
|
||||||
static int
|
}
|
||||||
fgOptFlightPlan( const char *arg )
|
waypoints->push_back(arg);
|
||||||
{
|
|
||||||
parse_flightplan ( arg );
|
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1496,7 +1446,7 @@ struct OptionDesc {
|
||||||
{"turbulence", true, OPTION_FUNC, "", false, "", fgOptTurbulence },
|
{"turbulence", true, OPTION_FUNC, "", false, "", fgOptTurbulence },
|
||||||
{"ceiling", true, OPTION_FUNC, "", false, "", fgOptCeiling },
|
{"ceiling", true, OPTION_FUNC, "", false, "", fgOptCeiling },
|
||||||
{"wp", true, OPTION_FUNC, "", false, "", fgOptWp },
|
{"wp", true, OPTION_FUNC, "", false, "", fgOptWp },
|
||||||
{"flight-plan", true, OPTION_FUNC, "", false, "", fgOptFlightPlan },
|
{"flight-plan", true, OPTION_STRING, "/autopilot/route-manager/file-path", false, "", NULL },
|
||||||
{"config", true, OPTION_FUNC, "", false, "", fgOptConfig },
|
{"config", true, OPTION_FUNC, "", false, "", fgOptConfig },
|
||||||
{"aircraft", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
{"aircraft", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
||||||
{"vehicle", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
{"vehicle", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
||||||
|
|
Loading…
Add table
Reference in a new issue