mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Use simulator from plugin if plugin is connected
This commit is contained in:
@@ -221,7 +221,7 @@ namespace BlackCore
|
||||
CAircraftModelList CContextSimulator::getModelSet() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
const CSimulatorInfo simulator = m_modelSetSimulator.get();
|
||||
const CSimulatorInfo simulator = this->getModelSetLoaderSimulator();
|
||||
if (!simulator.isSingleSimulator()) { return CAircraftModelList(); }
|
||||
|
||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
||||
@@ -231,6 +231,18 @@ namespace BlackCore
|
||||
CSimulatorInfo CContextSimulator::getModelSetLoaderSimulator() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.second)
|
||||
{
|
||||
if (m_simulatorPlugin.second->isConnected())
|
||||
{
|
||||
if (m_simulatorPlugin.second->isEmulatedDriver())
|
||||
{
|
||||
// specialized version returning the "emulated info"
|
||||
return this->getSimulatorPluginInfo().getSimulatorInfo();
|
||||
}
|
||||
return m_simulatorPlugin.first.getSimulatorInfo();
|
||||
}
|
||||
}
|
||||
return m_modelSetSimulator.get();
|
||||
}
|
||||
|
||||
@@ -238,7 +250,7 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (this->isSimulatorAvailable()) { return; }
|
||||
if (this->isSimulatorAvailable()) { return; } // if a plugin is loaded, do ignore this
|
||||
m_modelSetSimulator.set(simulator);
|
||||
const CAircraftModelList models = this->getModelSet(); // cache synced
|
||||
m_aircraftMatcher.setModelSet(models, simulator, false);
|
||||
|
||||
@@ -211,6 +211,11 @@ namespace BlackSimPlugin
|
||||
this->emitSimulatorCombinedStatus();
|
||||
}
|
||||
|
||||
CSimulatorInfo CSimulatorEmulated::getEmulatedSimulator() const
|
||||
{
|
||||
return m_pluginSettings.get().getEmulatedSimulator();
|
||||
}
|
||||
|
||||
bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -90,6 +90,9 @@ namespace BlackSimPlugin
|
||||
//! UI setter
|
||||
void setCombinedStatus(bool connected, bool simulating, bool paused);
|
||||
|
||||
//! The emulated simulated simulator
|
||||
BlackMisc::Simulation::CSimulatorInfo getEmulatedSimulator() const;
|
||||
|
||||
//! Internal own aircraft
|
||||
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
||||
const BlackMisc::Simulation::CSimulatedAircraft &getInternalOwnAircraft() const { return m_myAircraft; }
|
||||
|
||||
Reference in New Issue
Block a user