refs #791, also perform lookup in simulator plugin`s CSimulatorFsCommon::setOwnAircraftModel

This commit is contained in:
Klaus Basan
2016-10-29 04:07:33 +02:00
parent 4e2a01c1e4
commit 4478af119d
3 changed files with 12 additions and 2 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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)
{