diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index 912e6e395..11dfd83da 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -8,6 +8,7 @@ */ #include "blackcore/simulatorcommon.h" +#include "blackcore/db/databaseutils.h" #include "blackmisc/aviation/aircraftsituation.h" #include "blackmisc/aviation/callsign.h" #include "blackmisc/interpolator.h" @@ -30,6 +31,7 @@ using namespace BlackMisc::Simulation; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Simulation; using namespace BlackMisc::Weather; +using namespace BlackCore::Db; namespace BlackCore { @@ -162,6 +164,13 @@ namespace BlackCore } } + CAircraftModel CSimulatorCommon::reverseLookupModel(const CAircraftModel &model) + { + bool modified = false; + const CAircraftModel reverseModel = CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified); + return reverseModel; + } + CAircraftModel CSimulatorCommon::getDefaultModel() const { return m_defaultModel; diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 1628a7cb3..02f9688e7 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -134,6 +134,8 @@ namespace BlackCore qint64 m_statsUpdateAircraftTimeAvgMs = 0; //!< statistics update time int m_statsUpdateAircraftCountMs = 0; //!< statistics update time + //! Lookup against DB data + static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model); private: bool m_debugMessages = false; //!< Display debug messages diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.cpp b/src/plugins/simulator/fscommon/simulatorfscommon.cpp index b9c040680..b542c171f 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.cpp +++ b/src/plugins/simulator/fscommon/simulatorfscommon.cpp @@ -79,8 +79,7 @@ namespace BlackSimPlugin if (!model.hasModelString()) { return; } if (this->getOwnAircraftModel() != model) { - CAircraftModel newModel(model); - newModel.setModelType(CAircraftModel::TypeOwnSimulatorModel); + const CAircraftModel newModel = reverseLookupModel(model); const bool updated = this->updateOwnModel(newModel); // update in provider (normally the context) if (updated) {