mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 20:25:29 +08:00
Use simulator from plugin if plugin is connected
This commit is contained in:
committed by
Mat Sutcliffe
parent
19c9a51c38
commit
4c9654d81d
@@ -221,7 +221,7 @@ namespace BlackCore
|
|||||||
CAircraftModelList CContextSimulator::getModelSet() const
|
CAircraftModelList CContextSimulator::getModelSet() const
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
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(); }
|
if (!simulator.isSingleSimulator()) { return CAircraftModelList(); }
|
||||||
|
|
||||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
||||||
@@ -231,6 +231,18 @@ namespace BlackCore
|
|||||||
CSimulatorInfo CContextSimulator::getModelSetLoaderSimulator() const
|
CSimulatorInfo CContextSimulator::getModelSetLoaderSimulator() const
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
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();
|
return m_modelSetSimulator.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +250,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
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);
|
m_modelSetSimulator.set(simulator);
|
||||||
const CAircraftModelList models = this->getModelSet(); // cache synced
|
const CAircraftModelList models = this->getModelSet(); // cache synced
|
||||||
m_aircraftMatcher.setModelSet(models, simulator, false);
|
m_aircraftMatcher.setModelSet(models, simulator, false);
|
||||||
|
|||||||
@@ -211,6 +211,11 @@ namespace BlackSimPlugin
|
|||||||
this->emitSimulatorCombinedStatus();
|
this->emitSimulatorCombinedStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSimulatorInfo CSimulatorEmulated::getEmulatedSimulator() const
|
||||||
|
{
|
||||||
|
return m_pluginSettings.get().getEmulatedSimulator();
|
||||||
|
}
|
||||||
|
|
||||||
bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft)
|
bool CSimulatorEmulated::changeInternalCom(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ namespace BlackSimPlugin
|
|||||||
//! UI setter
|
//! UI setter
|
||||||
void setCombinedStatus(bool connected, bool simulating, bool paused);
|
void setCombinedStatus(bool connected, bool simulating, bool paused);
|
||||||
|
|
||||||
|
//! The emulated simulated simulator
|
||||||
|
BlackMisc::Simulation::CSimulatorInfo getEmulatedSimulator() const;
|
||||||
|
|
||||||
//! Internal own aircraft
|
//! Internal own aircraft
|
||||||
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
//! \remark normally used by corresponding BlackSimPlugin::Emulated::CSimulatorEmulatedMonitorDialog
|
||||||
const BlackMisc::Simulation::CSimulatedAircraft &getInternalOwnAircraft() const { return m_myAircraft; }
|
const BlackMisc::Simulation::CSimulatedAircraft &getInternalOwnAircraft() const { return m_myAircraft; }
|
||||||
|
|||||||
Reference in New Issue
Block a user