diff --git a/src/blackgui/editors/interpolationsetupform.cpp b/src/blackgui/editors/interpolationsetupform.cpp index 694b14d48..67bb59e7c 100644 --- a/src/blackgui/editors/interpolationsetupform.cpp +++ b/src/blackgui/editors/interpolationsetupform.cpp @@ -40,8 +40,7 @@ namespace BlackGui ui->cb_DebugDriver->setChecked(setup.showSimulatorDebugMessages()); ui->cb_LogInterpolation->setChecked(setup.logInterpolation()); ui->cb_EnableParts->setChecked(setup.isAircraftPartsEnabled()); - ui->cb_ForceFullInterpolation->setChecked(setup.isForcingFullInterpolation()); - ui->cb_EnableGndFlag->setChecked(setup.isGndFlagEnabled()); + ui->cb_ForceVtolInterpolation->setChecked(setup.isForcingVtolInterpolation()); ui->cb_SendGndFlagToSim->setChecked(setup.isSendingGndFlagToSimulator()); ui->cb_FixSceneryOffset->setChecked(setup.isFixingSceneryOffset()); @@ -54,8 +53,7 @@ namespace BlackGui { CInterpolationAndRenderingSetupPerCallsign setup; setup.setEnabledAircraftParts(ui->cb_EnableParts->isChecked()); - setup.setEnabledGndFLag(ui->cb_EnableGndFlag->isChecked()); - setup.setForceFullInterpolation(ui->cb_ForceFullInterpolation->isChecked()); + setup.setForceVtolInterpolation(ui->cb_ForceVtolInterpolation->isChecked()); setup.setLogInterpolation(ui->cb_LogInterpolation->isChecked()); setup.setSendingGndFlagToSimulator(ui->cb_SendGndFlagToSim->isChecked()); setup.setSimulatorDebuggingMessages(ui->cb_DebugDriver->isChecked()); @@ -69,8 +67,7 @@ namespace BlackGui CGuiUtility::checkBoxReadOnly(ui->cb_DebugDriver, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_LogInterpolation, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_EnableParts, readonly); - CGuiUtility::checkBoxReadOnly(ui->cb_ForceFullInterpolation, readonly); - CGuiUtility::checkBoxReadOnly(ui->cb_EnableGndFlag, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ForceVtolInterpolation, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_SendGndFlagToSim, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_FixSceneryOffset, readonly); ui->co_InterpolatorMode->setEnabled(!readonly); diff --git a/src/blackgui/editors/interpolationsetupform.ui b/src/blackgui/editors/interpolationsetupform.ui index a247604b0..6738fee2a 100644 --- a/src/blackgui/editors/interpolationsetupform.ui +++ b/src/blackgui/editors/interpolationsetupform.ui @@ -6,7 +6,7 @@ 0 0 - 236 + 240 102 @@ -42,7 +42,34 @@ - + + + + send gnd.to simulator + + + true + + + + + + + force VTOL interpolation + + + + + + + fix scenery offset + + + true + + + + enable parts @@ -52,34 +79,6 @@ - - - - use (network) gnd.flag - - - - - - - send gnd.to simulator - - - - - - - force full interpolation - - - - - - - fix scenery offset - - - diff --git a/src/blackgui/models/interpolationsetupmodel.cpp b/src/blackgui/models/interpolationsetupmodel.cpp index 0b5f213f6..04438ba3d 100644 --- a/src/blackgui/models/interpolationsetupmodel.cpp +++ b/src/blackgui/models/interpolationsetupmodel.cpp @@ -27,10 +27,9 @@ namespace BlackGui m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", CInterpolationAndRenderingSetupPerCallsign::IndexCallsign, CCallsign::IndexCallsignString)); this->m_columns.addColumn(CColumn::standardString("interpolator", CInterpolationAndRenderingSetupPerCallsign::IndexInterpolatorModeAsString)); m_columns.addColumn(CColumn("parts", "aircraft parts", CInterpolationAndRenderingSetupPerCallsign::IndexEnabledAircraftParts, new CBoolIconFormatter("parts", "aircraft parts"))); - m_columns.addColumn(CColumn("en.gnd.", "enable gnd (network)", CInterpolationAndRenderingSetupPerCallsign::IndexEnableGndFlag, new CBoolIconFormatter("en.gnd.", "enable gnd."))); m_columns.addColumn(CColumn("send gnd.", "send gnd.", CInterpolationAndRenderingSetupPerCallsign::IndexSendGndFlagToSimulator, new CBoolIconFormatter("send gnd.", "send gnd."))); m_columns.addColumn(CColumn("sc.os.", "fix scenery offset", CInterpolationAndRenderingSetupPerCallsign::IndexFixSceneryOffset, new CBoolIconFormatter("sc.os.", "fix scenery offset"))); - m_columns.addColumn(CColumn("full", "full int.", CInterpolationAndRenderingSetupPerCallsign::IndexForceFullInterpolation, new CBoolIconFormatter("full", "full int."))); + m_columns.addColumn(CColumn("VTOL", "VTOL interpolstion", CInterpolationAndRenderingSetupPerCallsign::IndexForceVtolInterpolation, new CBoolIconFormatter("VTOL", "VTOL interpolation"))); m_columns.addColumn(CColumn("sim.dbg.", "simulator debug", CInterpolationAndRenderingSetupPerCallsign::IndexSimulatorDebugMessages, new CBoolIconFormatter("sim.dbg.", "simulator debug"))); m_columns.addColumn(CColumn("log.int.", "log.interpolation", CInterpolationAndRenderingSetupPerCallsign::IndexLogInterpolation, new CBoolIconFormatter("log.int.", "log.interpolation"))); // default sort order diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.cpp b/src/blackmisc/simulation/interpolationrenderingsetup.cpp index ddb9a7ce5..bb8920f40 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.cpp +++ b/src/blackmisc/simulation/interpolationrenderingsetup.cpp @@ -24,13 +24,6 @@ namespace BlackMisc CInterpolationAndRenderingSetupBase::CInterpolationAndRenderingSetupBase() { } - bool CInterpolationAndRenderingSetupBase::setEnabledGndFLag(bool enabled) - { - if (enabled == m_enabledGndFlag) { return false; } - m_enabledGndFlag = enabled; - return true; - } - bool CInterpolationAndRenderingSetupBase::setSendingGndFlagToSimulator(bool sendFLag) { if (sendFLag == m_sendGndToSim) { return false; } @@ -91,9 +84,8 @@ namespace BlackMisc { case IndexLogInterpolation: return CVariant::fromValue(m_logInterpolation); case IndexSimulatorDebugMessages: return CVariant::fromValue(m_simulatorDebugMessages); - case IndexForceFullInterpolation: return CVariant::fromValue(m_forceFullInterpolation); + case IndexForceVtolInterpolation: return CVariant::fromValue(m_forceVtolInterpolation); case IndexEnabledAircraftParts: return CVariant::fromValue(m_enabledAircraftParts); - case IndexEnableGndFlag: return CVariant::fromValue(m_enabledGndFlag); case IndexSendGndFlagToSimulator: return CVariant::fromValue(m_sendGndToSim); case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode); case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString()); @@ -111,9 +103,8 @@ namespace BlackMisc { case IndexLogInterpolation: m_logInterpolation = variant.toBool(); return; case IndexSimulatorDebugMessages: m_simulatorDebugMessages = variant.toBool(); return; - case IndexForceFullInterpolation: m_forceFullInterpolation = variant.toBool(); return; + case IndexForceVtolInterpolation: m_forceVtolInterpolation = variant.toBool(); return; case IndexEnabledAircraftParts: m_enabledAircraftParts = variant.toBool(); return; - case IndexEnableGndFlag: m_enabledGndFlag = variant.toBool(); return; case IndexSendGndFlagToSimulator: m_sendGndToSim = variant.toBool(); return; case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return; case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return; @@ -130,9 +121,8 @@ namespace BlackMisc QStringLiteral("Interpolator: ") % this->getInterpolatorModeAsString() % QStringLiteral(" | Dbg.sim.msgs: ") % boolToYesNo(m_simulatorDebugMessages) % QStringLiteral(" | log interpolation: ") % boolToYesNo(m_logInterpolation) % - QStringLiteral(" | force full interpolation: ") % boolToYesNo(m_forceFullInterpolation) % + QStringLiteral(" | force VTOL interpolation: ") % boolToYesNo(m_forceVtolInterpolation) % QStringLiteral(" | enable parts: ") % boolToYesNo(m_enabledAircraftParts) % - QStringLiteral(" | enable gnd: ") % boolToYesNo(m_enabledGndFlag) % QStringLiteral(" | send gnd: ") % boolToYesNo(m_sendGndToSim) % QStringLiteral(" | fix.scenery offset: ") % boolToYesNo(m_fixSceneryOffset); } @@ -255,10 +245,11 @@ namespace BlackMisc { m_logInterpolation = baseValues.logInterpolation(); m_simulatorDebugMessages = baseValues.showSimulatorDebugMessages(); - m_forceFullInterpolation = baseValues.isForcingFullInterpolation(); + m_forceVtolInterpolation = baseValues.isForcingVtolInterpolation(); m_enabledAircraftParts = baseValues.isAircraftPartsEnabled(); - m_enabledGndFlag = baseValues.isGndFlagEnabled(); m_sendGndToSim = baseValues.isSendingGndFlagToSimulator(); + m_fixSceneryOffset = baseValues.isFixingSceneryOffset(); + m_interpolatorMode = baseValues.getInterpolatorMode(); } QString CInterpolationAndRenderingSetupGlobal::convertToQString(bool i18n) const @@ -318,11 +309,10 @@ namespace BlackMisc CPropertyIndexList diff; if (this->logInterpolation() != globalSetup.logInterpolation()) { diff.push_back(IndexLogInterpolation); } if (this->showSimulatorDebugMessages() != globalSetup.showSimulatorDebugMessages()) { diff.push_back(IndexSimulatorDebugMessages); } - if (this->isForcingFullInterpolation() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexForceFullInterpolation); } + if (this->isForcingVtolInterpolation() != globalSetup.isForcingVtolInterpolation()) { diff.push_back(IndexForceVtolInterpolation); } if (this->isAircraftPartsEnabled() != globalSetup.isAircraftPartsEnabled()) { diff.push_back(IndexEnabledAircraftParts); } - if (this->isGndFlagEnabled() != globalSetup.isGndFlagEnabled()) { diff.push_back(IndexEnableGndFlag); } if (this->isSendingGndFlagToSimulator() != globalSetup.isSendingGndFlagToSimulator()) { diff.push_back(IndexSendGndFlagToSimulator); } - if (this->isFixingSceneryOffset() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexFixSceneryOffset); } + if (this->isFixingSceneryOffset() != globalSetup.isForcingVtolInterpolation()) { diff.push_back(IndexFixSceneryOffset); } return diff; } diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.h b/src/blackmisc/simulation/interpolationrenderingsetup.h index 9aa9f8c1b..f1f501e85 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.h +++ b/src/blackmisc/simulation/interpolationrenderingsetup.h @@ -33,9 +33,8 @@ namespace BlackMisc { IndexLogInterpolation = CPropertyIndex::GlobalIndexCInterpolatioRenderingSetup, IndexSimulatorDebugMessages, - IndexForceFullInterpolation, + IndexForceVtolInterpolation, IndexSendGndFlagToSimulator, - IndexEnableGndFlag, IndexEnabledAircraftParts, IndexInterpolatorMode, IndexInterpolatorModeAsString, @@ -62,10 +61,10 @@ namespace BlackMisc void setLogInterpolation(bool log) { m_logInterpolation = log; } //! Full interpolation (skip optimizations like checking if aircraft moves etc.) - bool isForcingFullInterpolation() const { return m_forceFullInterpolation; } + bool isForcingVtolInterpolation() const { return m_forceVtolInterpolation; } //! Force full interpolation - void setForceFullInterpolation(bool force) { m_forceFullInterpolation = force; } + void setForceVtolInterpolation(bool force) { m_forceVtolInterpolation = force; } //! Set enabled aircraft parts bool setEnabledAircraftParts(bool enabled); @@ -76,12 +75,6 @@ namespace BlackMisc //! Aircraft parts enabled (still requires the other aircraft to send parts) bool isAircraftPartsEnabled() const { return m_enabledAircraftParts; } - //! Set gnd.flag enabled (aircraft supports gnd.flag) - bool setEnabledGndFLag(bool enabled); - - //! Is gnd.flag enabled (aircraft supports gnd.flag) - bool isGndFlagEnabled() const { return m_enabledGndFlag; } - //! Send GND flag to simulator bool isSendingGndFlagToSimulator() const { return m_sendGndToSim; } @@ -130,9 +123,8 @@ namespace BlackMisc bool m_logInterpolation = false; //!< Debug messages in interpolator bool m_simulatorDebugMessages = false; //!< Debug messages of simulator (aka plugin) - bool m_forceFullInterpolation = false; //!< always do a full interpolation, even if aircraft is not moving + bool m_forceVtolInterpolation = false; //!< always do a full interpolation, even if aircraft is not moving bool m_enabledAircraftParts = true; //!< Enable aircraft parts - bool m_enabledGndFlag = true; //!< Enable gnd.flag bool m_sendGndToSim = true; //!< Send the gnd.flag to simulator bool m_fixSceneryOffset = true; //!< Fix. scenery offset int m_interpolatorMode = static_cast(Spline); //!< interpolator mode (spline, ...) @@ -213,10 +205,9 @@ namespace BlackMisc CInterpolationAndRenderingSetupGlobal, BLACK_METAMEMBER(logInterpolation), BLACK_METAMEMBER(simulatorDebugMessages), - BLACK_METAMEMBER(forceFullInterpolation), + BLACK_METAMEMBER(forceVtolInterpolation), BLACK_METAMEMBER(sendGndToSim), BLACK_METAMEMBER(enabledAircraftParts), - BLACK_METAMEMBER(enabledGndFlag), BLACK_METAMEMBER(fixSceneryOffset), BLACK_METAMEMBER(interpolatorMode), BLACK_METAMEMBER(maxRenderedAircraft), @@ -273,10 +264,9 @@ namespace BlackMisc CInterpolationAndRenderingSetupPerCallsign, BLACK_METAMEMBER(logInterpolation), BLACK_METAMEMBER(simulatorDebugMessages), - BLACK_METAMEMBER(forceFullInterpolation), + BLACK_METAMEMBER(forceVtolInterpolation), BLACK_METAMEMBER(sendGndToSim), BLACK_METAMEMBER(enabledAircraftParts), - BLACK_METAMEMBER(enabledGndFlag), BLACK_METAMEMBER(fixSceneryOffset), BLACK_METAMEMBER(interpolatorMode) ); diff --git a/src/blackmisc/simulation/interpolator.cpp b/src/blackmisc/simulation/interpolator.cpp index 19ea97a0c..6465d5bfb 100644 --- a/src/blackmisc/simulation/interpolator.cpp +++ b/src/blackmisc/simulation/interpolator.cpp @@ -72,11 +72,12 @@ namespace BlackMisc } template - CAircraftSituationList CInterpolator::remoteAircraftSituationsAndChange(bool useSceneryOffset) + CAircraftSituationList CInterpolator::remoteAircraftSituationsAndChange(const CInterpolationAndRenderingSetupPerCallsign &setup) { + const bool vtol = setup.isForcingVtolInterpolation() || m_model.isVtol(); CAircraftSituationList validSituations = this->remoteAircraftSituations(m_callsign); - m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), m_model.isVtol(), true, true); - if (useSceneryOffset && m_currentSituationChange.hasSceneryDeviation() && m_model.hasCG()) + m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), vtol, true, true); + if (setup.isFixingSceneryOffset() && m_currentSituationChange.hasSceneryDeviation() && m_model.hasCG()) { const CLength os = m_currentSituationChange.getGuessedSceneryDeviationCG(); m_currentSceneryOffset = os; @@ -84,7 +85,7 @@ namespace BlackMisc { const CLength addValue = os * -1.0; // positive values means too high, negative values too low int changed = validSituations.addAltitudeOffset(addValue); - m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), m_model.isVtol(), true, true); // recalculate + m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), vtol, true, true); // recalculate Q_UNUSED(changed); } } @@ -359,7 +360,7 @@ namespace BlackMisc m_currentTimeMsSinceEpoch = currentTimeSinceEpoc; m_situationsLastModified = this->situationsLastModified(m_callsign); m_currentSetup = setup; - m_currentSituations = this->remoteAircraftSituationsAndChange(setup.isFixingSceneryOffset()); + m_currentSituations = this->remoteAircraftSituationsAndChange(setup); m_currentInterpolationStatus.reset(); m_currentPartsStatus.reset(); diff --git a/src/blackmisc/simulation/interpolator.h b/src/blackmisc/simulation/interpolator.h index c829f7dfe..f15b36e89 100644 --- a/src/blackmisc/simulation/interpolator.h +++ b/src/blackmisc/simulation/interpolator.h @@ -263,7 +263,7 @@ namespace BlackMisc //! Get situations and calculate change, also correct altitudes if applicable //! \remark calculates offset (scenery) and situations change - Aviation::CAircraftSituationList remoteAircraftSituationsAndChange(bool useSceneryOffset); + Aviation::CAircraftSituationList remoteAircraftSituationsAndChange(const CInterpolationAndRenderingSetupPerCallsign &setup); //! Center of gravity, fetched from provider in case needed PhysicalQuantities::CLength getAndFetchModelCG();