refs #852 Added a floating-point onGround value in CAircraftParts.

This commit is contained in:
Mathew Sutcliffe
2017-01-09 02:21:03 +00:00
parent 3e70ab1207
commit c00a13a29c
2 changed files with 17 additions and 0 deletions

View File

@@ -133,5 +133,14 @@ namespace BlackMisc
return this->m_engines.isEngineOn(number);
}
double CAircraftParts::isOnGroundInterpolated() const
{
if (this->m_isOnGroundInterpolated < 0)
{
return this->m_isOnGround ? 1.0 : 0.0;
}
return this->m_isOnGroundInterpolated;
}
} // namespace
} // namespace

View File

@@ -116,6 +116,12 @@ namespace BlackMisc
//! Set aircraft on ground
void setOnGround(bool onGround) { m_isOnGround = onGround; }
//! Is aircraft on ground? (Smoothly interpolated between 0 and 1.)
double isOnGroundInterpolated() const;
//! Set aircraft on ground. (Smoothly interpolated between 0 and 1.)
void setOnGroundInterpolated(double onGround) { m_isOnGroundInterpolated = onGround; }
//! Milliseconds to add to timestamp for interpolation
void setTimeOffsetMs(qint64 offset) { this->m_timeOffsetMs = offset; }
@@ -135,6 +141,7 @@ namespace BlackMisc
bool m_gearDown = false;
bool m_spoilersOut = false;
bool m_isOnGround = false;
double m_isOnGroundInterpolated = -1;
qint64 m_timeOffsetMs = 0;
BLACK_METACLASS(
@@ -145,6 +152,7 @@ namespace BlackMisc
BLACK_METAMEMBER_NAMED(spoilersOut, "spoilers_out"),
BLACK_METAMEMBER_NAMED(engines, "engines"),
BLACK_METAMEMBER_NAMED(isOnGround, "on_ground"),
BLACK_METAMEMBER(isOnGroundInterpolated, 0, DisabledForJson | DisabledForComparison),
BLACK_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForJson | DisabledForComparison),
BLACK_METAMEMBER(timeOffsetMs, 0, DisabledForJson | DisabledForComparison)
);