1
0
Fork 0

Merge branch 'next' of gitorious.org:fg/flightgear into next

This commit is contained in:
Curtis L. Olson 2011-10-26 12:43:24 -05:00
commit c1437d2c52
3 changed files with 13 additions and 5 deletions

View file

@ -838,11 +838,12 @@ bool FGAIAircraft::leadPointReached(FGAIWaypoint* curr) {
}
bool FGAIAircraft::aiTrafficVisible() {
SGGeod userPos(SGGeod::fromDeg(fgGetDouble("/position/longitude-deg"),
fgGetDouble("/position/latitude-deg")));
return (SGGeodesy::distanceNm(userPos, pos) <= TRAFFICTOAIDISTTODIE);
bool FGAIAircraft::aiTrafficVisible()
{
SGVec3d cartPos = SGVec3d::fromGeod(pos);
const double d2 = (TRAFFICTOAIDISTTODIE * SG_NM_TO_METER) *
(TRAFFICTOAIDISTTODIE * SG_NM_TO_METER);
return (distSqr(cartPos, globals->get_aircraft_positon_cart()) < d2);
}

View file

@ -380,6 +380,11 @@ FGGlobals::get_aircraft_position() const
throw sg_exception("Can't get aircraft position", "FGGlobals::get_aircraft_position()" );
}
const SGVec3d&
FGGlobals::get_aircraft_positon_cart() const
{
return SGVec3d::fromGeod(get_aircraft_position());
}
// Save the current state as the initial state.

View file

@ -267,6 +267,8 @@ public:
const SGGeod & get_aircraft_position() const;
const SGVec3d& get_aircraft_positon_cart() const;
inline FGModelMgr *get_model_mgr () { return model_mgr; }
inline void set_model_mgr (FGModelMgr * mgr)