1
0
Fork 0

Fix altitude units error loading plans, spotted by Csaba Halasz (Jester).

This commit is contained in:
jmt 2009-11-14 10:57:13 +00:00 committed by Tim Moore
parent f11572cd64
commit 7bb785c72c

View file

@ -709,16 +709,16 @@ void FGRouteMgr::parseRouteWaypoint(SGPropertyNode* aWP)
} }
SGPropertyNode_ptr altProp = aWP->getChild("altitude-ft"); SGPropertyNode_ptr altProp = aWP->getChild("altitude-ft");
double alt = cruise->getDoubleValue("altitude-ft") * SG_FEET_TO_METER; double altM = cruise->getDoubleValue("altitude-ft") * SG_FEET_TO_METER;
if (altProp) { if (altProp) {
alt = altProp->getDoubleValue(); altM = altProp->getDoubleValue() * SG_FEET_TO_METER;
} }
string ident(aWP->getStringValue("ident")); string ident(aWP->getStringValue("ident"));
if (aWP->hasChild("longitude-deg")) { if (aWP->hasChild("longitude-deg")) {
// explicit longitude/latitude // explicit longitude/latitude
SGWayPoint swp(aWP->getDoubleValue("longitude-deg"), SGWayPoint swp(aWP->getDoubleValue("longitude-deg"),
aWP->getDoubleValue("latitude-deg"), alt, aWP->getDoubleValue("latitude-deg"), altM,
SGWayPoint::WGS84, ident, aWP->getStringValue("name")); SGWayPoint::WGS84, ident, aWP->getStringValue("name"));
add_waypoint(swp); add_waypoint(swp);
} else if (aWP->hasChild("navid")) { } else if (aWP->hasChild("navid")) {
@ -739,7 +739,7 @@ void FGRouteMgr::parseRouteWaypoint(SGPropertyNode* aWP)
SGGeodesy::direct(p->geod(), radialDeg, offsetNm * SG_NM_TO_METER, pos, az2); SGGeodesy::direct(p->geod(), radialDeg, offsetNm * SG_NM_TO_METER, pos, az2);
} }
SGWayPoint swp(pos.getLongitudeDeg(), pos.getLatitudeDeg(), alt, SGWayPoint swp(pos.getLongitudeDeg(), pos.getLatitudeDeg(), altM,
SGWayPoint::WGS84, ident, ""); SGWayPoint::WGS84, ident, "");
add_waypoint(swp); add_waypoint(swp);
} else { } else {
@ -749,7 +749,7 @@ void FGRouteMgr::parseRouteWaypoint(SGPropertyNode* aWP)
throw sg_io_exception("bad route file, unknown waypoint:" + ident); throw sg_io_exception("bad route file, unknown waypoint:" + ident);
} }
SGWayPoint swp(p->longitude(), p->latitude(), alt, SGWayPoint swp(p->longitude(), p->latitude(), altM,
SGWayPoint::WGS84, p->ident(), p->name()); SGWayPoint::WGS84, p->ident(), p->name());
add_waypoint(swp); add_waypoint(swp);
} }