mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Aircraft ICAO code of own model is wrong
Although the reverse lookup of a model is correct, it's aircraft ICAO code is wrong Issues found * in the driver the ICAO code is permanently overridden -> commented out * there are two contexts, own aircraft and simulator, but only one uses reverse lookup -> now both * using Qt::QueuedConnection for context -> GUI
This commit is contained in:
@@ -226,7 +226,6 @@ namespace BlackCore
|
||||
}
|
||||
emit this->movedAircraft();
|
||||
}
|
||||
|
||||
}
|
||||
} // only if simulating
|
||||
}
|
||||
@@ -249,7 +248,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// changed model
|
||||
emit this->changedModel(model);
|
||||
emit this->changedModel(updateModel);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackcore/context/contextownaircraftimpl.h"
|
||||
#include "blackcore/context/contextsimulatorimpl.h"
|
||||
#include "blackcore/db/databaseutils.h"
|
||||
#include "blackcore/corefacade.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackcore/pluginmanagersimulator.h"
|
||||
@@ -43,6 +44,7 @@
|
||||
#include <QPointer>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackCore::Db;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -374,7 +376,7 @@ namespace BlackCore
|
||||
Q_ASSERT(c);
|
||||
c = connect(simulator, &ISimulator::physicallyAddingRemoteModelFailed, this, &CContextSimulator::onAddingRemoteAircraftFailed);
|
||||
Q_ASSERT(c);
|
||||
c = connect(simulator, &ISimulator::ownAircraftModelChanged, this, &IContextSimulator::ownAircraftModelChanged);
|
||||
c = connect(simulator, &ISimulator::ownAircraftModelChanged, this, &CContextSimulator::onOwnSimulatorModelChanged);
|
||||
Q_ASSERT(c);
|
||||
c = connect(simulator, &ISimulator::aircraftRenderingChanged, this, &IContextSimulator::aircraftRenderingChanged);
|
||||
Q_ASSERT(c);
|
||||
@@ -960,6 +962,16 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::onOwnSimulatorModelChanged(const CAircraftModel &model)
|
||||
{
|
||||
CAircraftModel lookupModel(model);
|
||||
if (!lookupModel.isLoadedFromDb())
|
||||
{
|
||||
lookupModel = this->reverseLookupModel(model);
|
||||
}
|
||||
this->ownAircraftModelChanged(lookupModel);
|
||||
}
|
||||
|
||||
void CContextSimulator::stopSimulatorListeners()
|
||||
{
|
||||
for (const CSimulatorPluginInfo &info : getAvailableSimulatorPlugins())
|
||||
@@ -996,6 +1008,13 @@ namespace BlackCore
|
||||
m_matchingMessages.remove(callsign);
|
||||
}
|
||||
|
||||
CAircraftModel CContextSimulator::reverseLookupModel(const CAircraftModel &model)
|
||||
{
|
||||
bool modified = false;
|
||||
const CAircraftModel reverseModel = CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified);
|
||||
return reverseModel;
|
||||
}
|
||||
|
||||
void CContextSimulator::initByLastUsedModelSet()
|
||||
{
|
||||
// no models in matcher, but in cache, we can set them as default
|
||||
|
||||
@@ -203,6 +203,9 @@ namespace BlackCore
|
||||
//! Listener reports the simulator has started
|
||||
void onSimulatorStarted(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
|
||||
|
||||
//! Simulator model has been changed
|
||||
void onOwnSimulatorModelChanged(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Failed adding remote aircraft
|
||||
void onAddingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, bool disabled, const BlackMisc::CStatusMessage &message);
|
||||
|
||||
@@ -236,6 +239,9 @@ namespace BlackCore
|
||||
//! Clear matching messages
|
||||
void clearMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Reverse lookup of a model
|
||||
BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Load the last know model set
|
||||
void initByLastUsedModelSet();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user