mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T773, return flag if elevation was set for a ground position
This commit is contained in:
committed by
Mat Sutcliffe
parent
a7ae5290d0
commit
b128d40342
@@ -64,7 +64,9 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
int CAircraftSituationList::setGroundElevationCheckedAndGuessGround(const CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const CAircraftModel &model, CAircraftSituationChange *changeOut)
|
||||
int CAircraftSituationList::setGroundElevationCheckedAndGuessGround(
|
||||
const CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const CAircraftModel &model,
|
||||
CAircraftSituationChange *changeOut, bool *setForOnGroundPosition)
|
||||
{
|
||||
if (elevationPlane.isNull()) { return 0; }
|
||||
if (this->isEmpty()) { return 0; }
|
||||
@@ -74,6 +76,7 @@ namespace BlackMisc
|
||||
const CAircraftSituationChange simpleChange(*this, model.getCG(), model.isVtol(), true, false);
|
||||
int c = 0; // changed elevations
|
||||
bool latest = true;
|
||||
bool setForOnGndPosition = false;
|
||||
|
||||
for (CAircraftSituation &s : *this)
|
||||
{
|
||||
@@ -82,12 +85,21 @@ namespace BlackMisc
|
||||
{
|
||||
// simpleChange is only valid for the latest situation
|
||||
// this will do nothing if not appropriate!
|
||||
s.guessOnGround(latest ? simpleChange : CAircraftSituationChange::null(), model);
|
||||
const bool guessed = s.guessOnGround(latest ? simpleChange : CAircraftSituationChange::null(), model);
|
||||
Q_UNUSED(guessed)
|
||||
c++;
|
||||
|
||||
// if not guessed and "on ground" we mark the "elevation"
|
||||
// as an elevation for a ground position
|
||||
if (!setForOnGndPosition && s.hasInboundGroundDetails() && s.isOnGround())
|
||||
{
|
||||
setForOnGndPosition = true;
|
||||
}
|
||||
}
|
||||
latest = false;
|
||||
latest = false; // only first pos. is "the latest" one
|
||||
}
|
||||
|
||||
if (setForOnGroundPosition) { *setForOnGroundPosition = setForOnGndPosition; }
|
||||
if (changeOut)
|
||||
{
|
||||
const CAircraftSituationChange change(*this, model.getCG(), model.isVtol(), true, true);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
|
||||
//! Set ground elevation from elevation plane and guess ground
|
||||
//! \note requires a sorted list latest first
|
||||
int setGroundElevationCheckedAndGuessGround(const Geo::CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const Simulation::CAircraftModel &model, CAircraftSituationChange *changeOut);
|
||||
int setGroundElevationCheckedAndGuessGround(const Geo::CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const Simulation::CAircraftModel &model, CAircraftSituationChange *changeOut, bool *setForOnGroundPosition);
|
||||
|
||||
//! Adjust flag from parts by using CAircraftSituation::adjustGroundFlag
|
||||
int adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor = 0.1);
|
||||
|
||||
Reference in New Issue
Block a user