Julian Foad: fixes to meters/feet confusion. (Also length of "--vNorth="
is 9 not 8.) Note that the initial altitude setting was placing us way below the ground, but as it doesn't seem to have caused us problems, it's probably redundant!
This commit is contained in:
parent
22d0448657
commit
4cf4edcfb4
2 changed files with 19 additions and 19 deletions
|
@ -380,12 +380,15 @@ bool fgInitPosition( void ) {
|
||||||
|
|
||||||
// if we requested on ground startups
|
// if we requested on ground startups
|
||||||
if ( fgGetBool( "/sim/startup/onground" ) ) {
|
if ( fgGetBool( "/sim/startup/onground" ) ) {
|
||||||
fgSetDouble("/position/altitude", scenery.cur_elev + 1 );
|
fgSetDouble( "/position/altitude", (scenery.cur_elev + 1)
|
||||||
|
* METERS_TO_FEET );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if requested altitude is below ground level
|
// if requested altitude is below ground level
|
||||||
if ( scenery.cur_elev > fgGetDouble("/position/altitude") - 1) {
|
if ( scenery.cur_elev >
|
||||||
fgSetDouble("/position/altitude", scenery.cur_elev + 1 );
|
fgGetDouble("/position/altitude") * METERS_TO_FEET - 1) {
|
||||||
|
fgSetDouble("/position/altitude",
|
||||||
|
(scenery.cur_elev + 1) * METERS_TO_FEET );
|
||||||
}
|
}
|
||||||
|
|
||||||
FG_LOG( FG_GENERAL, FG_INFO,
|
FG_LOG( FG_GENERAL, FG_INFO,
|
||||||
|
|
|
@ -186,6 +186,8 @@ fgSetDefaults ()
|
||||||
fgSetString("/sim/networking/call-sign", "Johnny");
|
fgSetString("/sim/networking/call-sign", "Johnny");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// parse a time string ([+/-]%f[:%f[:%f]]) into hours
|
||||||
static double
|
static double
|
||||||
parse_time(const string& time_in) {
|
parse_time(const string& time_in) {
|
||||||
char *time_str, num[256];
|
char *time_str, num[256];
|
||||||
|
@ -265,6 +267,7 @@ parse_time(const string& time_in) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// parse a date string (yyyy:mm:dd:hh:mm:ss) into a time_t (seconds)
|
||||||
static long int
|
static long int
|
||||||
parse_date( const string& date)
|
parse_date( const string& date)
|
||||||
{
|
{
|
||||||
|
@ -373,7 +376,7 @@ parse_date( const string& date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// parse degree in the form of [+/-]hhh:mm:ss
|
// parse angle in the form of [+/-]ddd:mm:ss into degrees
|
||||||
static double
|
static double
|
||||||
parse_degree( const string& degree_str) {
|
parse_degree( const string& degree_str) {
|
||||||
double result = parse_time( degree_str );
|
double result = parse_time( degree_str );
|
||||||
|
@ -384,7 +387,7 @@ parse_degree( const string& degree_str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse time offset command line option
|
// parse time offset string into seconds
|
||||||
static int
|
static int
|
||||||
parse_time_offset( const string& time_str) {
|
parse_time_offset( const string& time_str) {
|
||||||
int result;
|
int result;
|
||||||
|
@ -454,7 +457,7 @@ parse_channel( const string& type, const string& channel_str ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse --wp=ID[,alt]
|
// Parse --wp=ID[@alt]
|
||||||
static bool
|
static bool
|
||||||
parse_wp( const string& arg ) {
|
parse_wp( const string& arg ) {
|
||||||
string id, alt_str;
|
string id, alt_str;
|
||||||
|
@ -586,52 +589,46 @@ parse_option (const string& arg)
|
||||||
atof(arg.substr(11)) * METER_TO_FEET);
|
atof(arg.substr(11)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--uBody=" ) == 0 ) {
|
} else if ( arg.find( "--uBody=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "UVW");
|
fgSetString("/sim/startup/speed-set", "UVW");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/uBody", atof(arg.substr(8)));
|
fgSetDouble("/velocities/uBody", atof(arg.substr(8)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/uBody",
|
fgSetDouble("/velocities/uBody",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(8)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--vBody=" ) == 0 ) {
|
} else if ( arg.find( "--vBody=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "UVW");
|
fgSetString("/sim/startup/speed-set", "UVW");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/vBody", atof(arg.substr(8)));
|
fgSetDouble("/velocities/vBody", atof(arg.substr(8)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/vBody",
|
fgSetDouble("/velocities/vBody",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(8)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--wBody=" ) == 0 ) {
|
} else if ( arg.find( "--wBody=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "UVW");
|
fgSetString("/sim/startup/speed-set", "UVW");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/wBody", atof(arg.substr(8)));
|
fgSetDouble("/velocities/wBody", atof(arg.substr(8)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/wBody",
|
fgSetDouble("/velocities/wBody",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(8)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--vNorth=" ) == 0 ) {
|
} else if ( arg.find( "--vNorth=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "NED");
|
fgSetString("/sim/startup/speed-set", "NED");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/speed-north", atof(arg.substr(8)));
|
fgSetDouble("/velocities/speed-north", atof(arg.substr(9)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/speed-north",
|
fgSetDouble("/velocities/speed-north",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(9)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--vEast=" ) == 0 ) {
|
} else if ( arg.find( "--vEast=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "NED");
|
fgSetString("/sim/startup/speed-set", "NED");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/speed-east", atof(arg.substr(8)));
|
fgSetDouble("/velocities/speed-east", atof(arg.substr(8)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/speed-east",
|
fgSetDouble("/velocities/speed-east",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(8)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--vDown=" ) == 0 ) {
|
} else if ( arg.find( "--vDown=" ) == 0 ) {
|
||||||
fgSetString("/sim/startup/speed-set", "NED");
|
fgSetString("/sim/startup/speed-set", "NED");
|
||||||
// FIXME: the units are totally confused here
|
|
||||||
if ( fgGetString("/sim/startup/units") == "feet" )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/velocities/speed-down", atof(arg.substr(8)));
|
fgSetDouble("/velocities/speed-down", atof(arg.substr(8)));
|
||||||
else
|
else
|
||||||
fgSetDouble("/velocities/speed-down",
|
fgSetDouble("/velocities/speed-down",
|
||||||
atof(arg.substr(8)) * FEET_TO_METER);
|
atof(arg.substr(8)) * METER_TO_FEET);
|
||||||
} else if ( arg.find( "--vc=" ) == 0) {
|
} else if ( arg.find( "--vc=" ) == 0) {
|
||||||
fgSetString("/sim/startup/speed-set", "knots");
|
fgSetString("/sim/startup/speed-set", "knots");
|
||||||
fgSetDouble("/velocities/airspeed", atof(arg.substr(5)));
|
fgSetDouble("/velocities/airspeed", atof(arg.substr(5)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue