mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
refs #791, reverse lookup for own model in the utils class
This commit is contained in:
@@ -20,13 +20,32 @@ namespace BlackCore
|
||||
{
|
||||
namespace Db
|
||||
{
|
||||
CAircraftModel CDatabaseUtils::consolidateModelWithDbData(const CAircraftModel &model, bool force)
|
||||
CAircraftModel CDatabaseUtils::consolidateOwnAircraftModelWithDbData(const CAircraftModel &model, bool force, bool *modified)
|
||||
{
|
||||
return CDatabaseUtils::consolidateModelWithDbData(model, force, nullptr);
|
||||
bool myModified = false;
|
||||
CAircraftModel ownModel = CDatabaseUtils::consolidateModelWithDbData(model, force, &myModified);
|
||||
// special case here, as we have some specific values for a local model
|
||||
|
||||
if (myModified)
|
||||
{
|
||||
ownModel.updateMissingParts(model);
|
||||
ownModel.setFileName(model.getFileName());
|
||||
myModified = true;
|
||||
}
|
||||
if (ownModel.getModelType() != CAircraftModel::TypeOwnSimulatorModel)
|
||||
{
|
||||
ownModel.setModelType(CAircraftModel::TypeOwnSimulatorModel);
|
||||
myModified = true;
|
||||
}
|
||||
if (modified) { *modified = myModified; }
|
||||
return ownModel;
|
||||
}
|
||||
|
||||
CAircraftModel CDatabaseUtils::consolidateModelWithDbData(const CAircraftModel &model, bool force, bool *modified)
|
||||
{
|
||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing application object");
|
||||
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "No web services");
|
||||
|
||||
if (modified) { *modified = false; }
|
||||
if (!model.hasModelString()) { return model; }
|
||||
if (!force && model.hasValidDbKey()) { return model; }
|
||||
|
||||
Reference in New Issue
Block a user