mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +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;
|
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 (elevationPlane.isNull()) { return 0; }
|
||||||
if (this->isEmpty()) { return 0; }
|
if (this->isEmpty()) { return 0; }
|
||||||
@@ -74,6 +76,7 @@ namespace BlackMisc
|
|||||||
const CAircraftSituationChange simpleChange(*this, model.getCG(), model.isVtol(), true, false);
|
const CAircraftSituationChange simpleChange(*this, model.getCG(), model.isVtol(), true, false);
|
||||||
int c = 0; // changed elevations
|
int c = 0; // changed elevations
|
||||||
bool latest = true;
|
bool latest = true;
|
||||||
|
bool setForOnGndPosition = false;
|
||||||
|
|
||||||
for (CAircraftSituation &s : *this)
|
for (CAircraftSituation &s : *this)
|
||||||
{
|
{
|
||||||
@@ -82,12 +85,21 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
// simpleChange is only valid for the latest situation
|
// simpleChange is only valid for the latest situation
|
||||||
// this will do nothing if not appropriate!
|
// 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++;
|
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)
|
if (changeOut)
|
||||||
{
|
{
|
||||||
const CAircraftSituationChange change(*this, model.getCG(), model.isVtol(), true, true);
|
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
|
//! Set ground elevation from elevation plane and guess ground
|
||||||
//! \note requires a sorted list latest first
|
//! \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
|
//! Adjust flag from parts by using CAircraftSituation::adjustGroundFlag
|
||||||
int adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor = 0.1);
|
int adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor = 0.1);
|
||||||
|
|||||||
Reference in New Issue
Block a user