mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Avoid issues if simulator is NOT yet set in emulateed driver
This commit is contained in:
committed by
Mat Sutcliffe
parent
6bc2a15f61
commit
6cefb5175d
@@ -691,7 +691,16 @@ namespace BlackCore
|
|||||||
connect(sApp, &CApplication::aboutToShutdown, this, &ISimulator::unload, Qt::QueuedConnection);
|
connect(sApp, &CApplication::aboutToShutdown, this, &ISimulator::unload, Qt::QueuedConnection);
|
||||||
|
|
||||||
// provider
|
// provider
|
||||||
|
if (pluginInfo.isEmulatedPlugin() && !pluginInfo.getSimulatorInfo().isSingleSimulator())
|
||||||
|
{
|
||||||
|
// emulated driver with NO info yet
|
||||||
|
CLogMessage(this).info(u"Plugin '%1' with no simulator info yet, hope it will be set later") << pluginInfo.getIdentifier();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// NORMAL CASE or plugin with info already set
|
||||||
this->setNewPluginInfo(pluginInfo, m_multiSettings.getSettings(pluginInfo.getSimulatorInfo()));
|
this->setNewPluginInfo(pluginInfo, m_multiSettings.getSettings(pluginInfo.getSimulatorInfo()));
|
||||||
|
}
|
||||||
|
|
||||||
// info data
|
// info data
|
||||||
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
|
m_simulatorInternals.setSimulatorName(this->getSimulatorName());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||||
#include "blackmisc/simulation/flightgear/flightgearutil.h"
|
#include "blackmisc/simulation/flightgear/flightgearutil.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
@@ -195,7 +196,12 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CSimulatorSettings CMultiSimulatorSettings::getSettings(const CSimulatorInfo &simulator) const
|
CSimulatorSettings CMultiSimulatorSettings::getSettings(const CSimulatorInfo &simulator) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
if (!simulator.isSingleSimulator())
|
||||||
|
{
|
||||||
|
// mostly happening with emulated driver, VERIFY for better debugging
|
||||||
|
BLACK_VERIFY_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||||
|
return CSimulatorSettings();
|
||||||
|
}
|
||||||
switch (simulator.getSimulator())
|
switch (simulator.getSimulator())
|
||||||
{
|
{
|
||||||
case CSimulatorInfo::FG: return m_simSettingsFG.get();
|
case CSimulatorInfo::FG: return m_simSettingsFG.get();
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorEmulated::isConnected() const
|
bool CSimulatorEmulated::isConnected() const
|
||||||
{
|
{
|
||||||
if (canLog()) m_monitorWidget->appendReceivingCall(Q_FUNC_INFO);
|
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO); }
|
||||||
return m_connected;
|
return m_connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ namespace BlackSimPlugin
|
|||||||
QScopedPointer<CSimulatorEmulatedMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
|
QScopedPointer<CSimulatorEmulatedMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
|
||||||
BlackMisc::CConnectionGuard m_connectionGuard; //!< connected with provider
|
BlackMisc::CConnectionGuard m_connectionGuard; //!< connected with provider
|
||||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_pluginSettings { this, &CSimulatorEmulated::onSettingsChanged };
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_pluginSettings { this, &CSimulatorEmulated::onSettingsChanged };
|
||||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_multiSettings { this };
|
|
||||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CInterpolatorMultiWrapper> m_interpolators; //!< interpolators per callsign
|
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CInterpolatorMultiWrapper> m_interpolators; //!< interpolators per callsign
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user