mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Simplify CInterpolator::getInterpolation()
Avoid requiring a do {} while(false) with nested if & break by using a simple if()
This commit is contained in:
@@ -215,17 +215,16 @@ namespace BlackMisc::Simulation
|
||||
CInterpolationResult CInterpolator<Derived>::getInterpolation(qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, uint32_t aircraftNumber)
|
||||
{
|
||||
CInterpolationResult result;
|
||||
do
|
||||
{
|
||||
|
||||
const bool init = this->initIniterpolationStepData(currentTimeSinceEpoc, setup, aircraftNumber);
|
||||
Q_ASSERT_X(!m_currentInterpolationStatus.isInterpolated(), Q_FUNC_INFO, "Expect reset status");
|
||||
if (!m_unitTest && !init) { break; } // failure in real scenarios, unit tests move on
|
||||
if (init || m_unitTest) // ignore failure in unittest
|
||||
{
|
||||
Q_ASSERT_X(m_currentTimeMsSinceEpoch > 0, Q_FUNC_INFO, "No valid timestamp, interpolator initialized?");
|
||||
const CAircraftSituation interpolatedSituation = this->getInterpolatedSituation();
|
||||
const CAircraftParts interpolatedParts = this->getInterpolatedOrGuessedParts(aircraftNumber);
|
||||
result.setValues(interpolatedSituation, interpolatedParts);
|
||||
}
|
||||
while (false);
|
||||
|
||||
result.setStatus(m_currentInterpolationStatus, m_currentPartsStatus);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user