cosmetics:
- only call globals->set_initial_waypoints() if the waypoints list address has actually changed, that is: if it has just been initialized - remove trailing spaces - fix indentation
This commit is contained in:
parent
d452ad97f1
commit
4b856b508a
1 changed files with 31 additions and 29 deletions
|
@ -536,56 +536,58 @@ 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 parse wp and parse flight-plan options don't work anymore, because
|
||||||
// the route manager and the airport subsystems have not yet been initialized
|
// the route manager and the airport subsystems have not yet been initialized
|
||||||
// at this stage.
|
// at this stage.
|
||||||
|
|
||||||
// Parse --wp=ID[@alt]
|
// Parse --wp=ID[@alt]
|
||||||
static void
|
static void
|
||||||
parse_wp( const string& arg ) {
|
parse_wp( const string& arg ) {
|
||||||
string_list *waypoints = globals->get_initial_waypoints();
|
string_list *waypoints = globals->get_initial_waypoints();
|
||||||
if (!waypoints) {
|
if (!waypoints) {
|
||||||
waypoints = new string_list;
|
waypoints = new string_list;
|
||||||
|
globals->set_initial_waypoints(waypoints);
|
||||||
}
|
}
|
||||||
waypoints->push_back(arg);
|
waypoints->push_back(arg);
|
||||||
globals->set_initial_waypoints(waypoints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse --flight-plan=[file]
|
// Parse --flight-plan=[file]
|
||||||
static bool
|
static bool
|
||||||
parse_flightplan(const string& arg)
|
parse_flightplan(const string& arg)
|
||||||
{
|
{
|
||||||
string_list *waypoints = globals->get_initial_waypoints();
|
string_list *waypoints = globals->get_initial_waypoints();
|
||||||
if (!waypoints)
|
if (!waypoints) {
|
||||||
waypoints = new string_list;
|
waypoints = new string_list;
|
||||||
sg_gzifstream in(arg.c_str());
|
globals->set_initial_waypoints(waypoints);
|
||||||
if ( !in.is_open() ) {
|
}
|
||||||
return false;
|
|
||||||
}
|
sg_gzifstream in(arg.c_str());
|
||||||
while ( true ) {
|
if ( !in.is_open() )
|
||||||
string line;
|
return false;
|
||||||
|
|
||||||
|
while ( true ) {
|
||||||
|
string line;
|
||||||
|
|
||||||
#if defined( macintosh )
|
#if defined( macintosh )
|
||||||
getline( in, line, '\r' );
|
getline( in, line, '\r' );
|
||||||
#else
|
#else
|
||||||
getline( in, line, '\n' );
|
getline( in, line, '\n' );
|
||||||
#endif
|
#endif
|
||||||
|
// catch extraneous (DOS) line ending character
|
||||||
// catch extraneous (DOS) line ending character
|
if ( line[line.length() - 1] < 32 )
|
||||||
if ( line[line.length() - 1] < 32 ) {
|
line = line.substr( 0, line.length()-1 );
|
||||||
line = line.substr( 0, line.length()-1 );
|
|
||||||
|
if ( in.eof() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
waypoints->push_back(line);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
if ( in.eof() ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
waypoints->push_back(line);
|
|
||||||
}
|
|
||||||
globals->set_initial_waypoints(waypoints);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fgOptLanguage( const char *arg )
|
fgOptLanguage( const char *arg )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue