mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T632, more detailled entry check for adding a remote aircraft (finds empty callsign)
This commit is contained in:
@@ -81,9 +81,16 @@ namespace BlackCore
|
||||
|
||||
bool ISimulator::logicallyAddRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
|
||||
{
|
||||
Q_ASSERT_X(remoteAircraft.hasModelString(), Q_FUNC_INFO, "Missing model string");
|
||||
Q_ASSERT_X(remoteAircraft.hasCallsign(), Q_FUNC_INFO, "Missing callsign");
|
||||
if (!this->validateModelOfAircraft(remoteAircraft))
|
||||
{
|
||||
const CCallsign cs = remoteAircraft.getCallsign();
|
||||
CLogMessage(this).warning(u"Invalid aircraft detected, which will be disabled: '%1' '%2'") << cs << remoteAircraft.getModelString();
|
||||
this->updateAircraftEnabled(cs, false);
|
||||
this->updateAircraftRendered(cs, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// no invalid model should ever reach this place here
|
||||
const bool renderingRestricted = this->getInterpolationSetupGlobal().isRenderingRestricted();
|
||||
if (this->showDebugLogMessage()) { this->debugLogMessage(Q_FUNC_INFO, QStringLiteral("Restricted: %1 cs: '%2' enabled: %3").arg(boolToYesNo(renderingRestricted), remoteAircraft.getCallsignAsString(), boolToYesNo(remoteAircraft.isEnabled()))); }
|
||||
if (!remoteAircraft.isEnabled()) { return false; }
|
||||
@@ -1072,6 +1079,27 @@ namespace BlackCore
|
||||
return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator);
|
||||
}
|
||||
|
||||
bool ISimulator::validateModelOfAircraft(const CSimulatedAircraft &aircraft) const
|
||||
{
|
||||
const CAircraftModel model = aircraft.getModel();
|
||||
if (!aircraft.hasCallsign())
|
||||
{
|
||||
CLogMessage(this).warning(u"Missing callsign for '%1'") << aircraft.getModelString();
|
||||
return false;
|
||||
}
|
||||
if (!model.hasModelString())
|
||||
{
|
||||
CLogMessage(this).warning(u"No model string for callsign '%1'") << aircraft.getCallsign();
|
||||
return false;
|
||||
}
|
||||
if (model.isCallsignEmpty())
|
||||
{
|
||||
CLogMessage(this).warning(u"No callsign for model of aircraft '%1'") << aircraft.getCallsign();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString ISimulator::latestLoggedDataFormatted(const CCallsign &cs) const
|
||||
{
|
||||
const SituationLog s = m_interpolationLogger.getLastSituationLog(cs);
|
||||
|
||||
@@ -538,6 +538,9 @@ namespace BlackCore
|
||||
//! Get the model set
|
||||
BlackMisc::Simulation::CAircraftModelList getModelSet() const;
|
||||
|
||||
//! Validate if model has callsign and such
|
||||
bool validateModelOfAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
||||
|
||||
//! Lookup against DB data
|
||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user