mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #791, also perform lookup in simulator plugin`s CSimulatorFsCommon::setOwnAircraftModel
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user