mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-05 17:05:57 +08:00
fix: remove comments
This commit is contained in:
@@ -243,7 +243,6 @@ namespace swift::simplugin::msfs2024common
|
||||
{
|
||||
static const QString a1("aircraft (non ATC)");
|
||||
static const QString a2("aircraft (sim.object)");
|
||||
// static const QString p("probe");
|
||||
static const QString u("unknown");
|
||||
switch (type)
|
||||
{
|
||||
@@ -383,18 +382,6 @@ namespace swift::simplugin::msfs2024common
|
||||
return c > 0;
|
||||
}
|
||||
|
||||
// int CSimConnectObjects::removeAllProbes()
|
||||
//{
|
||||
// const QList<CSimConnectObject> probes = this->getProbes();
|
||||
// int c = 0;
|
||||
// for (const CSimConnectObject &probe : probes)
|
||||
// {
|
||||
// this->remove(probe.getCallsign());
|
||||
// c++;
|
||||
// }
|
||||
// return c;
|
||||
// }
|
||||
|
||||
bool CSimConnectObjects::containsPendingAdded() const
|
||||
{
|
||||
bool cont = false;
|
||||
|
||||
@@ -857,20 +857,6 @@ namespace swift::simplugin::msfs2024common
|
||||
return m_simConnectObjects.removeByOtherSimObject(trace.simObject);
|
||||
}
|
||||
|
||||
// TODO TZ check if nessesary in MSFS2024
|
||||
// void CSimulatorMsfs2024::removeCamera(CSimConnectObject &simObject)
|
||||
//{
|
||||
// // not in FSX
|
||||
// Q_UNUSED(simObject)
|
||||
//}
|
||||
|
||||
// TODO TZ check if nessesary in MSFS2024
|
||||
// void CSimulatorMsfs2024::removeObserver(CSimConnectObject &simObject)
|
||||
//{
|
||||
// // not in FSX
|
||||
// Q_UNUSED(simObject)
|
||||
//}
|
||||
|
||||
bool CSimulatorMsfs2024::triggerAutoTraceSendId(qint64 traceTimeMs)
|
||||
{
|
||||
if (m_traceSendId) { return false; } // no need
|
||||
@@ -1255,9 +1241,8 @@ namespace swift::simplugin::msfs2024common
|
||||
const CSimulatedAircraft verifyAircraft(simObject.getAircraft());
|
||||
const QPointer<CSimulatorMsfs2024> myself(this);
|
||||
|
||||
// TODO TZ check: Why 1000ms? Is this required in MSFS2024?
|
||||
// QTimer::singleShot(1000, this, [=] {
|
||||
QTimer::singleShot(100, this, [=] {
|
||||
QTimer::singleShot(1000, this, [=] {
|
||||
// verify aircraft and also triggers new add if required
|
||||
// do not do this in the event loop, so we do this deferred
|
||||
if (!myself || this->isShuttingDownOrDisconnected()) { return; }
|
||||
@@ -1334,14 +1319,9 @@ namespace swift::simplugin::msfs2024common
|
||||
this->requestModelInfoForSimObject(simObject);
|
||||
|
||||
this->removeFromAddPendingAndAddAgainAircraft(callsign); // no longer try to add
|
||||
if (m_addPendingAircraft.contains(callsign))
|
||||
{
|
||||
CLogMessage(this).info(u"removeFromAddPendingAndAddAgainAircraft failed 1 %1") << callsign;
|
||||
}
|
||||
const bool updated = this->updateAircraftRendered(callsign, true);
|
||||
if (updated)
|
||||
{
|
||||
CLogMessage(this).info(u"updateAircraftRendered 1 %1") << callsign;
|
||||
static const QString debugMsg("CS: '%1' model: '%2' verified, request/object id: %3 %4");
|
||||
if (this->showDebugLogMessage())
|
||||
{
|
||||
@@ -1511,13 +1491,8 @@ namespace swift::simplugin::msfs2024common
|
||||
|
||||
void CSimulatorMsfs2024::addPendingAircraft(AircraftAddMode mode)
|
||||
{
|
||||
if (m_addPendingAircraft.isEmpty())
|
||||
{
|
||||
CLogMessage(this).warning(u"addPendingAircraft is Empty");
|
||||
return;
|
||||
}
|
||||
if (m_addPendingAircraft.isEmpty()) { return; }
|
||||
const CCallsignSet aircraftCallsignsInRange(this->getAircraftInRangeCallsigns());
|
||||
// CSimulatedAircraftList toBeAddedAircraft; // aircraft still to be added
|
||||
CCallsignSet toBeRemovedCallsigns;
|
||||
|
||||
for (const CSimConnectObject &pendingSimObj : std::as_const(m_addPendingAircraft))
|
||||
@@ -1529,7 +1504,7 @@ namespace swift::simplugin::msfs2024common
|
||||
|
||||
// no longer required to be added
|
||||
// TOTO TZ
|
||||
// m_addPendingAircraft.removeCallsigns(toBeRemovedCallsigns);
|
||||
m_addPendingAircraft.removeCallsigns(toBeRemovedCallsigns);
|
||||
m_addAgainAircraftWhenRemoved.removeByCallsigns(toBeRemovedCallsigns);
|
||||
|
||||
// add aircraft, but "non blocking"
|
||||
@@ -1558,19 +1533,16 @@ namespace swift::simplugin::msfs2024common
|
||||
CSimConnectObject simObjectOld;
|
||||
if (callsign.isEmpty()) { return simObjectOld; }
|
||||
|
||||
CLogMessage(this).info(u"removeFromAddPendingAndAddAgainAircraft 1 %1") << callsign;
|
||||
|
||||
m_addAgainAircraftWhenRemoved.removeByCallsign(callsign);
|
||||
if (m_addPendingAircraft.contains(callsign))
|
||||
{
|
||||
CLogMessage(this).info(
|
||||
u"removeFromAddPendingAndAddAgainAircraft m_addPendingAircraft.contains(callsign) 2 %1")
|
||||
<< callsign;
|
||||
simObjectOld = m_addPendingAircraft[callsign];
|
||||
m_addPendingAircraft.remove(callsign);
|
||||
}
|
||||
// TODO TZ check if required
|
||||
CLogMessage(this).info(u"removeFromAddPendingAndAddAgainAircraft 3 %1 m_addPendingAircraft.count: %2")
|
||||
<< simObjectOld.getCallsignAsString() << m_addPendingAircraft.count();
|
||||
|
||||
return simObjectOld;
|
||||
}
|
||||
|
||||
@@ -1731,13 +1703,6 @@ namespace swift::simplugin::msfs2024common
|
||||
CSimpleCommandParser::registerCommand({ ".drv sblog on|off", "SB offsets logging on|off" });
|
||||
}
|
||||
|
||||
// CCallsign CSimulatorMsfs2024::getCallsignForPendingProbeRequests(DWORD requestId, bool remove)
|
||||
//{
|
||||
// const CCallsign cs = m_pendingProbeRequests.value(requestId);
|
||||
// if (remove) { m_pendingProbeRequests.remove(requestId); }
|
||||
// return cs;
|
||||
// }
|
||||
|
||||
const QString &CSimulatorMsfs2024::modeToString(CSimulatorMsfs2024::AircraftAddMode mode)
|
||||
{
|
||||
static const QString e("external call");
|
||||
@@ -1822,8 +1787,6 @@ namespace swift::simplugin::msfs2024common
|
||||
{
|
||||
const CCallsign callsign(newRemoteAircraft.getCallsign());
|
||||
|
||||
CLogMessage(this).info(u"physicallyAddRemoteAircraftImpl %1") << callsign.asString();
|
||||
|
||||
// entry checks
|
||||
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
||||
@@ -1858,9 +1821,6 @@ namespace swift::simplugin::msfs2024common
|
||||
const bool hasPendingAdded = m_simConnectObjects.containsPendingAdded();
|
||||
bool canAdd = this->isSimulating() && !hasPendingAdded;
|
||||
|
||||
CLogMessage(this).info(u"TEST 1 %1 %2 %3 %4")
|
||||
<< callsign.asString() << canAdd << this->isSimulating() << hasPendingAdded;
|
||||
|
||||
Q_ASSERT_X(!hasPendingAdded || m_simConnectObjects.countPendingAdded() < 2, Q_FUNC_INFO,
|
||||
"There must be only 0..1 pending objects");
|
||||
if (this->showDebugLogMessage() && true)
|
||||
@@ -1879,8 +1839,6 @@ namespace swift::simplugin::msfs2024common
|
||||
// this handles changed model strings or an update of the model
|
||||
if (m_simConnectObjects.contains(callsign))
|
||||
{
|
||||
CLogMessage(this).info(u"TEST 2 m_simConnectObjects.contains %1 ") << callsign.asString();
|
||||
|
||||
const CSimConnectObject simObject = m_simConnectObjects[callsign];
|
||||
const QString newModelString(newRemoteAircraft.getModelString());
|
||||
const QString simObjModelString(simObject.getAircraftModelString());
|
||||
@@ -1916,7 +1874,6 @@ namespace swift::simplugin::msfs2024common
|
||||
CAircraftSituation situation(newRemoteAircraft.getSituation());
|
||||
if (canAdd && situation.isPositionOrAltitudeNull())
|
||||
{
|
||||
CLogMessage(this).info(u"TEST 3 situation.isPositionOrAltitudeNull %1 ") << callsign.asString();
|
||||
// invalid position because position or altitude is null
|
||||
const CAircraftSituationList situations(this->remoteAircraftSituations(callsign));
|
||||
if (situations.isEmpty())
|
||||
@@ -1945,8 +1902,6 @@ namespace swift::simplugin::msfs2024common
|
||||
|
||||
if (!canAdd)
|
||||
{
|
||||
CLogMessage(this).info(u"TEST 4 !canAdd %1 ") << callsign.asString();
|
||||
|
||||
CSimConnectObject &addPendingObj = m_addPendingAircraft[newRemoteAircraft.getCallsign()];
|
||||
addPendingObj.setAircraft(newRemoteAircraft);
|
||||
addPendingObj.resetTimestampToNow();
|
||||
@@ -1965,7 +1920,6 @@ namespace swift::simplugin::msfs2024common
|
||||
return false;
|
||||
}
|
||||
|
||||
CLogMessage(this).info(u"TEST 5 CInterpolationAndRenderingSetupPerCallsign %1 ") << callsign.asString();
|
||||
// setup
|
||||
const CInterpolationAndRenderingSetupPerCallsign setup =
|
||||
this->getInterpolationSetupConsolidated(callsign, true);
|
||||
@@ -2401,27 +2355,27 @@ namespace swift::simplugin::msfs2024common
|
||||
|
||||
// in case we sent, we sent everything
|
||||
const bool simObjectAircraftType = simObject.isAircraftSimulatedObject(); // no real aircraft type
|
||||
const HRESULT hr1 = S_OK;
|
||||
// TODO TZ re-enable if checked
|
||||
// const HRESULT hr1 =
|
||||
// simObjectAircraftType ?
|
||||
// S_OK :
|
||||
// this->logAndTraceSendId(
|
||||
// SimConnect_SetDataOnSimObject(
|
||||
// m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftPartsWithoutLights,
|
||||
// static_cast<SIMCONNECT_OBJECT_ID>(objectId), SIMCONNECT_DATA_SET_FLAG_DEFAULT, 0,
|
||||
// sizeof(DataDefinitionRemoteAircraftPartsWithoutLights), &ddRemoteAircraftPartsWithoutLights),
|
||||
// traceId, simObject, "Failed so set parts", Q_FUNC_INFO,
|
||||
// "SimConnect_SetDataOnSimObject::ddRemoteAircraftPartsWithoutLights");
|
||||
const HRESULT hr1 =
|
||||
simObjectAircraftType ?
|
||||
S_OK :
|
||||
this->logAndTraceSendId(
|
||||
SimConnect_SetDataOnSimObject(
|
||||
m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftPartsWithoutLights,
|
||||
static_cast<SIMCONNECT_OBJECT_ID>(objectId), SIMCONNECT_DATA_SET_FLAG_DEFAULT, 0,
|
||||
sizeof(DataDefinitionRemoteAircraftPartsWithoutLights), &ddRemoteAircraftPartsWithoutLights),
|
||||
traceId, simObject, "Failed so set parts", Q_FUNC_INFO,
|
||||
"SimConnect_SetDataOnSimObject::ddRemoteAircraftPartsWithoutLights");
|
||||
|
||||
// TODO TZ handle flaps more precisely
|
||||
// is already handled in parts definition above
|
||||
// Sets flap handle to closest increment (0 to 16383)
|
||||
const DWORD flapsDw = static_cast<DWORD>(qMin(16383, qRound((parts.getFlapsPercent() / 100.0) * 16383)));
|
||||
const HRESULT hr2 = this->logAndTraceSendId(
|
||||
SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventFlapsSet, flapsDw,
|
||||
SIMCONNECT_GROUP_PRIORITY_HIGHEST,
|
||||
SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
|
||||
traceId, simObject, "Failed so set flaps", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventFlapsSet");
|
||||
// const DWORD flapsDw = static_cast<DWORD>(qMin(16383, qRound((parts.getFlapsPercent() / 100.0) * 16383)));
|
||||
const HRESULT hr2 = S_OK;
|
||||
// const HRESULT hr2 = this->logAndTraceSendId(
|
||||
// SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventFlapsSet, flapsDw,
|
||||
// SIMCONNECT_GROUP_PRIORITY_HIGHEST,
|
||||
// SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
|
||||
// traceId, simObject, "Failed so set flaps", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventFlapsSet");
|
||||
|
||||
const HRESULT hr3 = this->logAndTraceSendId(
|
||||
SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventGearSet, parts.isFixedGearDown() ? 1.0 : 0.0,
|
||||
@@ -2863,31 +2817,6 @@ namespace swift::simplugin::msfs2024common
|
||||
return d.arg(trace.sendId).arg(simObject.getObjectId()).arg(simObject.toQString(), trace.comment);
|
||||
}
|
||||
|
||||
// int CSimulatorMsfs2024::removeAllProbes()
|
||||
//{
|
||||
// if (!m_hSimConnect) { return 0; } // already disconnected
|
||||
// const QList<CSimConnectObject> probes = m_simConnectObjects.getProbes();
|
||||
|
||||
// int c = 0;
|
||||
// for (const CSimConnectObject &probeSimObject : probes)
|
||||
// {
|
||||
// if (!probeSimObject.isConfirmedAdded()) { continue; }
|
||||
// const SIMCONNECT_DATA_REQUEST_ID requestId =
|
||||
// probeSimObject.getRequestId(CSimConnectDefinitions::SimObjectRemove);
|
||||
// const HRESULT result = SimConnect_AIRemoveObject(
|
||||
// m_hSimConnect, static_cast<SIMCONNECT_OBJECT_ID>(probeSimObject.getObjectId()), requestId);
|
||||
// if (isOk(result)) { c++; }
|
||||
// else
|
||||
// {
|
||||
// CLogMessage(this).warning(u"Removing probe '%1' from simulator failed") <<
|
||||
// probeSimObject.getObjectId();
|
||||
// }
|
||||
// }
|
||||
// m_simConnectObjects.removeAllProbes();
|
||||
// m_pendingProbeRequests.clear();
|
||||
// return c;
|
||||
//}
|
||||
|
||||
CSimConnectObject CSimulatorMsfs2024::insertNewSimConnectObject(const CSimulatedAircraft &aircraft, DWORD requestId,
|
||||
CSimConnectObject::SimObjectType type,
|
||||
const CSimConnectObject &removedPendingObject)
|
||||
@@ -2923,12 +2852,6 @@ namespace swift::simplugin::msfs2024common
|
||||
return simObject;
|
||||
}
|
||||
|
||||
// const CAltitude &CSimulatorMsfs2024::terrainProbeAltitude()
|
||||
//{
|
||||
// static const CAltitude alt(50000, CLengthUnit::ft());
|
||||
// return alt;
|
||||
// }
|
||||
|
||||
QString CSimulatorMsfs2024::fsxCharToQString(const char *fsxChar, int size)
|
||||
{
|
||||
return QString::fromLatin1(fsxChar, size);
|
||||
|
||||
Reference in New Issue
Block a user