mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-08 10:45:36 +08:00
refs #865, based on discussion https://dev.vatsim-germany.org/issues/865#note-12
* do not call XP`s elevation provider if not needed in interpolator * some renaming/utility functions
This commit is contained in:
committed by
Mathew Sutcliffe
parent
47aa04b5e9
commit
1d967b08e8
@@ -100,7 +100,8 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
// take hint into account to calculate elevation and above ground level
|
||||
if (!hints.getElevation().isNull())
|
||||
// do not call for XP (lazy init)
|
||||
if (!hints.hasElevationProvider())
|
||||
{
|
||||
IInterpolator::setGroundElevationFromHint(hints, oldSituation, false);
|
||||
IInterpolator::setGroundElevationFromHint(hints, newSituation, false);
|
||||
@@ -147,11 +148,11 @@ namespace BlackMisc
|
||||
+ oldAlt,
|
||||
oldAlt.getReferenceDatum()));
|
||||
|
||||
// update current position by hints' elevation
|
||||
// for XP provided by hints.getElevationProvider at current position
|
||||
// for FSX/P3D provided as hints.getElevation which is set to current position of remote aircraft in simulator
|
||||
const CAltitude currentGroundElevation = hints.getGroundElevation(currentSituation);
|
||||
if (!currentGroundElevation.isNull()) { currentSituation.setGroundElevation(currentGroundElevation); }
|
||||
// Update current position by hints' elevation
|
||||
// * for XP provided by hints.getElevationProvider at current position
|
||||
// * for FSX/P3D provided as hints.getElevation which is set to current position of remote aircraft in simulator
|
||||
// As XP uses lazy init we will call getGroundElevation only when needed, so default here via getElevationPlane
|
||||
CAltitude currentGroundElevation(hints.getElevationPlane().getAltitudeIfWithinRadius(currentSituation));
|
||||
|
||||
// Interpolate between altitude and ground elevation, with proportions weighted according to interpolated onGround flag
|
||||
if (hints.hasAircraftParts())
|
||||
@@ -160,6 +161,7 @@ namespace BlackMisc
|
||||
log.groundFactor = groundFactor;
|
||||
if (groundFactor > 0.0)
|
||||
{
|
||||
currentGroundElevation = hints.getGroundElevation(currentSituation); // calls provider on XP
|
||||
if (!currentGroundElevation.isNull())
|
||||
{
|
||||
Q_ASSERT_X(currentGroundElevation.getReferenceDatum() == CAltitude::MeanSeaLevel, Q_FUNC_INFO, "Need MSL value");
|
||||
@@ -168,12 +170,14 @@ namespace BlackMisc
|
||||
oldAlt.getReferenceDatum()));
|
||||
}
|
||||
}
|
||||
currentSituation.setGroundElevation(currentGroundElevation);
|
||||
IInterpolator::setGroundFlagFromInterpolator(hints, groundFactor, currentSituation);
|
||||
}
|
||||
else
|
||||
{
|
||||
// guess ground flag
|
||||
constexpr double NoGroundFactor = -1;
|
||||
currentSituation.setGroundElevation(currentGroundElevation);
|
||||
IInterpolator::setGroundFlagFromInterpolator(hints, NoGroundFactor, currentSituation);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user