1. Patched simgear/magvar/magvar.[ch]xx to allow retrieval of the

magnetic variation for a specific location and date without running an
update cycle (I use this for setting up VOR default offsets in some
FlightGear patches).

2. [CRITICAL] Fixed some null-pointer bugs in simgear/misc/props.cxx.
This commit is contained in:
curt
2001-01-05 16:04:21 +00:00
parent 260dbeb3d2
commit 60e61a0627
3 changed files with 32 additions and 12 deletions

View File

@@ -49,3 +49,8 @@ void SGMagVar::update( double lon, double lat, double alt_m, double jd ) {
magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
}
double sgGetMagVar( double lon, double lat, double alt_m, double jd ) {
double field[6];
return calc_magvar( lat, lon, alt_m / 1000.0, (long)jd, field );
}

View File

@@ -55,4 +55,9 @@ public:
};
#endif // _LIGHT_HXX
// lookup the magvar for any arbitrary location (doesn't save state
// and note that this is a fair amount of cpu work)
double sgGetMagVar( double lon, double lat, double alt_m, double jd );
#endif // _MAGVAR_HXX

View File

@@ -1,4 +1,4 @@
// props.hxx - interface definition for a property list.
// props.cxx - implementation of a property list.
// Started Fall 2000 by David Megginson, david@megginson.com
// This code is released into the Public Domain.
//
@@ -1050,31 +1050,41 @@ SGPropertyNode::isTied () const
bool
SGPropertyNode::tie (const SGRawValue<bool> &rawValue, bool useDefault)
{
return (_value == 0 ? false : _value->tie(rawValue, useDefault));
if (_value == 0)
_value = new SGValue();
return _value->tie(rawValue, useDefault);
}
bool
SGPropertyNode::tie (const SGRawValue<int> &rawValue, bool useDefault)
{
return (_value == 0 ? false : _value->tie(rawValue, useDefault));
if (_value == 0)
_value = new SGValue();
return _value->tie(rawValue, useDefault);
}
bool
SGPropertyNode::tie (const SGRawValue<float> &rawValue, bool useDefault)
{
return (_value == 0 ? false : _value->tie(rawValue, useDefault));
if (_value == 0)
_value = new SGValue();
return _value->tie(rawValue, useDefault);
}
bool
SGPropertyNode::tie (const SGRawValue<double> &rawValue, bool useDefault)
{
return (_value == 0 ? false : _value->tie(rawValue, useDefault));
if (_value == 0)
_value = new SGValue();
return _value->tie(rawValue, useDefault);
}
bool
SGPropertyNode::tie (const SGRawValue<string> &rawValue, bool useDefault)
{
return (_value == 0 ? false : _value->tie(rawValue, useDefault));
if (_value == 0)
_value = new SGValue();
return _value->tie(rawValue, useDefault);
}
bool
@@ -1308,7 +1318,7 @@ SGPropertyNode::isTied (const string &relative_path) const
bool
SGPropertyNode::tie (const string &relative_path,
const SGRawValue<bool> &rawValue,
bool useDefault = true)
bool useDefault)
{
return getNode(relative_path, true)->tie(rawValue, useDefault);
}
@@ -1320,7 +1330,7 @@ SGPropertyNode::tie (const string &relative_path,
bool
SGPropertyNode::tie (const string &relative_path,
const SGRawValue<int> &rawValue,
bool useDefault = true)
bool useDefault)
{
return getNode(relative_path, true)->tie(rawValue, useDefault);
}
@@ -1332,7 +1342,7 @@ SGPropertyNode::tie (const string &relative_path,
bool
SGPropertyNode::tie (const string &relative_path,
const SGRawValue<float> &rawValue,
bool useDefault = true)
bool useDefault)
{
return getNode(relative_path, true)->tie(rawValue, useDefault);
}
@@ -1344,7 +1354,7 @@ SGPropertyNode::tie (const string &relative_path,
bool
SGPropertyNode::tie (const string &relative_path,
const SGRawValue<double> &rawValue,
bool useDefault = true)
bool useDefault)
{
return getNode(relative_path, true)->tie(rawValue, useDefault);
}
@@ -1356,7 +1366,7 @@ SGPropertyNode::tie (const string &relative_path,
bool
SGPropertyNode::tie (const string &relative_path,
const SGRawValue<string> &rawValue,
bool useDefault = true)
bool useDefault)
{
return getNode(relative_path, true)->tie(rawValue, useDefault);
}