mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T259, Ref T243 setSimulationEnvironmentProvider when simulator changes
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
#include "blackcore/context/contextnetworkimpl.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackcore/context/contextownaircraftimpl.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackcore/context/contextsimulatorimpl.h"
|
||||
#include "blackcore/corefacade.h"
|
||||
#include "blackcore/vatsim/networkvatlib.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
@@ -451,6 +451,23 @@ namespace BlackCore
|
||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance);
|
||||
}
|
||||
|
||||
void CContextNetwork::xCtxSimulatorStatusChanged(int status)
|
||||
{
|
||||
const ISimulator::SimulatorStatus simStatus = static_cast<ISimulator::SimulatorStatus>(status);
|
||||
if (m_network)
|
||||
{
|
||||
if (simStatus.testFlag(ISimulator::Connected))
|
||||
{
|
||||
const CContextSimulator *sim = this->getRuntime()->getCContextSimulator();
|
||||
m_network->setSimulationEnvironmentProvider(sim ? sim->simulator() : nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_network->setSimulationEnvironmentProvider(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CContextNetwork::updateMetars(const BlackMisc::Weather::CMetarList &metars)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
@@ -238,6 +238,10 @@ namespace BlackCore
|
||||
//! \sa CAirspaceAnalyzer
|
||||
//! \ingroup crosscontextfunction
|
||||
void xCtxSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance);
|
||||
|
||||
//! Status of simulator changed
|
||||
//! \ingroup crosscontextfunction
|
||||
void xCtxSimulatorStatusChanged(int status);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -456,7 +456,7 @@ namespace BlackCore
|
||||
sim->disconnect(this);
|
||||
sim->unload();
|
||||
sim->deleteLater();
|
||||
emit simulatorPluginChanged(CSimulatorPluginInfo());
|
||||
emit this->simulatorPluginChanged(CSimulatorPluginInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -475,7 +475,7 @@ namespace BlackCore
|
||||
CStatusMessageList *pMatchingMessages = m_enableMatchingMessages ? &matchingMessages : nullptr;
|
||||
const CAircraftModel aircraftModel = m_aircraftMatcher.getClosestMatch(remoteAircraft, pMatchingMessages);
|
||||
Q_ASSERT_X(remoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "Mismatching callsigns");
|
||||
updateAircraftModel(callsign, aircraftModel, identifier());
|
||||
this->updateAircraftModel(callsign, aircraftModel, identifier());
|
||||
const CSimulatedAircraft aircraftAfterModelApplied = getAircraftInRangeForCallsign(remoteAircraft.getCallsign());
|
||||
m_simulatorPlugin.second->logicallyAddRemoteAircraft(aircraftAfterModelApplied);
|
||||
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Logically added remote aircraft: %1").arg(aircraftAfterModelApplied.toQString()));
|
||||
@@ -730,6 +730,12 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
ISimulator *CContextSimulator::simulator() const
|
||||
{
|
||||
if (!this->isSimulatorAvailable()) { return nullptr; }
|
||||
return m_simulatorPlugin.second;
|
||||
}
|
||||
|
||||
void CContextSimulator::highlightAircraft(const CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const CTime &displayTime)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << aircraftToHighlight << enableHighlight << displayTime; }
|
||||
|
||||
@@ -134,6 +134,9 @@ namespace BlackCore
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".ris parts on|off", "aircraft parts"});
|
||||
}
|
||||
|
||||
//! Simulator object
|
||||
ISimulator *simulator() const;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CContextSimulator(CCoreFacadeConfig::ContextMode, CCoreFacade *runtime);
|
||||
|
||||
Reference in New Issue
Block a user