mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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();
|
emit this->movedAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} // only if simulating
|
} // only if simulating
|
||||||
}
|
}
|
||||||
@@ -249,7 +248,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// changed model
|
// changed model
|
||||||
emit this->changedModel(model);
|
emit this->changedModel(updateModel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "blackcore/context/contextownaircraft.h"
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
#include "blackcore/context/contextownaircraftimpl.h"
|
#include "blackcore/context/contextownaircraftimpl.h"
|
||||||
#include "blackcore/context/contextsimulatorimpl.h"
|
#include "blackcore/context/contextsimulatorimpl.h"
|
||||||
|
#include "blackcore/db/databaseutils.h"
|
||||||
#include "blackcore/corefacade.h"
|
#include "blackcore/corefacade.h"
|
||||||
#include "blackcore/application.h"
|
#include "blackcore/application.h"
|
||||||
#include "blackcore/pluginmanagersimulator.h"
|
#include "blackcore/pluginmanagersimulator.h"
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
|
using namespace BlackCore::Db;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
@@ -374,7 +376,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
c = connect(simulator, &ISimulator::physicallyAddingRemoteModelFailed, this, &CContextSimulator::onAddingRemoteAircraftFailed);
|
c = connect(simulator, &ISimulator::physicallyAddingRemoteModelFailed, this, &CContextSimulator::onAddingRemoteAircraftFailed);
|
||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
c = connect(simulator, &ISimulator::ownAircraftModelChanged, this, &IContextSimulator::ownAircraftModelChanged);
|
c = connect(simulator, &ISimulator::ownAircraftModelChanged, this, &CContextSimulator::onOwnSimulatorModelChanged);
|
||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
c = connect(simulator, &ISimulator::aircraftRenderingChanged, this, &IContextSimulator::aircraftRenderingChanged);
|
c = connect(simulator, &ISimulator::aircraftRenderingChanged, this, &IContextSimulator::aircraftRenderingChanged);
|
||||||
Q_ASSERT(c);
|
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()
|
void CContextSimulator::stopSimulatorListeners()
|
||||||
{
|
{
|
||||||
for (const CSimulatorPluginInfo &info : getAvailableSimulatorPlugins())
|
for (const CSimulatorPluginInfo &info : getAvailableSimulatorPlugins())
|
||||||
@@ -996,6 +1008,13 @@ namespace BlackCore
|
|||||||
m_matchingMessages.remove(callsign);
|
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()
|
void CContextSimulator::initByLastUsedModelSet()
|
||||||
{
|
{
|
||||||
// no models in matcher, but in cache, we can set them as default
|
// 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
|
//! Listener reports the simulator has started
|
||||||
void onSimulatorStarted(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
|
void onSimulatorStarted(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
|
||||||
|
|
||||||
|
//! Simulator model has been changed
|
||||||
|
void onOwnSimulatorModelChanged(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|
||||||
//! Failed adding remote aircraft
|
//! Failed adding remote aircraft
|
||||||
void onAddingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, bool disabled, const BlackMisc::CStatusMessage &message);
|
void onAddingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, bool disabled, const BlackMisc::CStatusMessage &message);
|
||||||
|
|
||||||
@@ -236,6 +239,9 @@ namespace BlackCore
|
|||||||
//! Clear matching messages
|
//! Clear matching messages
|
||||||
void clearMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign);
|
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
|
//! Load the last know model set
|
||||||
void initByLastUsedModelSet();
|
void initByLastUsedModelSet();
|
||||||
|
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
if (sGui && sGui->getIContextSimulator())
|
if (sGui && sGui->getIContextSimulator())
|
||||||
{
|
{
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::ownAircraftModelChanged, this, &CLoginComponent::onSimulatorModelChanged);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::ownAircraftModelChanged, this, &CLoginComponent::onSimulatorModelChanged, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginComponent::autoLogoffDetection);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginComponent::autoLogoffDetection, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// server and UI elements when in disconnect state
|
// server and UI elements when in disconnect state
|
||||||
|
|||||||
@@ -228,8 +228,9 @@ namespace BlackSimPlugin
|
|||||||
situation.setBank({ m_xplaneData.rollDeg, CAngleUnit::deg() });
|
situation.setBank({ m_xplaneData.rollDeg, CAngleUnit::deg() });
|
||||||
situation.setGroundSpeed({ m_xplaneData.groundspeedMs, CSpeedUnit::m_s() });
|
situation.setGroundSpeed({ m_xplaneData.groundspeedMs, CSpeedUnit::m_s() });
|
||||||
|
|
||||||
// updates
|
// Updates
|
||||||
updateOwnIcaoCodes(m_xplaneData.aircraftIcaoCode, CAirlineIcaoCode());
|
// Do not update ICAO codes, as this overrides reverse lookups
|
||||||
|
// updateOwnIcaoCodes(m_xplaneData.aircraftIcaoCode, CAirlineIcaoCode());
|
||||||
updateOwnSituation(situation);
|
updateOwnSituation(situation);
|
||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
@@ -276,7 +277,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
if (isConnected())
|
if (isConnected())
|
||||||
{
|
{
|
||||||
m_serviceProxy->getAircraftModelPathAsync(&m_xplaneData.aircraftModelPath);
|
m_serviceProxy->getAircraftModelPathAsync(&m_xplaneData.aircraftModelPath); // this is NOT the model string
|
||||||
m_serviceProxy->getAircraftIcaoCodeAsync(&m_xplaneData.aircraftIcaoCode);
|
m_serviceProxy->getAircraftIcaoCodeAsync(&m_xplaneData.aircraftIcaoCode);
|
||||||
m_serviceProxy->getBeaconLightsOnAsync(&m_xplaneData.beaconLightsOn);
|
m_serviceProxy->getBeaconLightsOnAsync(&m_xplaneData.beaconLightsOn);
|
||||||
m_serviceProxy->getLandingLightsOnAsync(&m_xplaneData.landingLightsOn);
|
m_serviceProxy->getLandingLightsOnAsync(&m_xplaneData.landingLightsOn);
|
||||||
|
|||||||
Reference in New Issue
Block a user