mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Ref T273, Ref T275 FSX/P3D uses simulator common function to skip sending equal parts/situations
This commit is contained in:
@@ -80,24 +80,31 @@ namespace BlackSimPlugin
|
|||||||
void fakeCurrentLightsInSimulator() { m_currentLightsInSim.setNull(false); }
|
void fakeCurrentLightsInSimulator() { m_currentLightsInSim.setNull(false); }
|
||||||
|
|
||||||
//! Parts as sent to simulator
|
//! Parts as sent to simulator
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
const DataDefinitionRemoteAircraftPartsWithoutLights &getPartsAsSent() const { return m_partsAsSent; }
|
const DataDefinitionRemoteAircraftPartsWithoutLights &getPartsAsSent() const { return m_partsAsSent; }
|
||||||
|
|
||||||
//! Parts as sent to simulator
|
//! Parts as sent to simulator
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
void setPartsAsSent(const DataDefinitionRemoteAircraftPartsWithoutLights &parts) { m_partsAsSent = parts; }
|
void setPartsAsSent(const DataDefinitionRemoteAircraftPartsWithoutLights &parts) { m_partsAsSent = parts; }
|
||||||
|
|
||||||
//! Invalidate parts as sent
|
//! Invalidate parts as sent
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
void invalidatePartsAsSent();
|
void invalidatePartsAsSent();
|
||||||
|
|
||||||
//! Parts as sent to simulator
|
//! Parts as sent to simulator
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
const SIMCONNECT_DATA_INITPOSITION &getPositionAsSent() const { return m_positionAsSent; }
|
const SIMCONNECT_DATA_INITPOSITION &getPositionAsSent() const { return m_positionAsSent; }
|
||||||
|
|
||||||
//! Position as sent
|
//! Position as sent
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
void setPositionAsSent(const SIMCONNECT_DATA_INITPOSITION &position) { m_positionAsSent = position; }
|
void setPositionAsSent(const SIMCONNECT_DATA_INITPOSITION &position) { m_positionAsSent = position; }
|
||||||
|
|
||||||
//! Same as sent
|
//! Same as sent
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
bool isSameAsSent(const SIMCONNECT_DATA_INITPOSITION &position) const;
|
bool isSameAsSent(const SIMCONNECT_DATA_INITPOSITION &position) const;
|
||||||
|
|
||||||
//! Invalidate position as sent;
|
//! Invalidate position as sent
|
||||||
|
//! \deprecated KB T273 use BlackCore::CSimulatorCommon isEqual / remember functions
|
||||||
void invalidatePositionAsSent();
|
void invalidatePositionAsSent();
|
||||||
|
|
||||||
//! Lights as sent to simulator
|
//! Lights as sent to simulator
|
||||||
|
|||||||
@@ -1275,15 +1275,16 @@ namespace BlackSimPlugin
|
|||||||
if (result.getInterpolationStatus().hasValidSituation())
|
if (result.getInterpolationStatus().hasValidSituation())
|
||||||
{
|
{
|
||||||
// update situation
|
// update situation
|
||||||
SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround);
|
if (!this->isEqualLastSent(result))
|
||||||
if (!simObject.isSameAsSent(position))
|
|
||||||
{
|
{
|
||||||
|
SIMCONNECT_DATA_INITPOSITION position = this->aircraftSituationToFsxPosition(result, sendGround);
|
||||||
m_simConnectObjects[simObject.getCallsign()].setPositionAsSent(position);
|
m_simConnectObjects[simObject.getCallsign()].setPositionAsSent(position);
|
||||||
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
|
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
|
||||||
static_cast<SIMCONNECT_OBJECT_ID>(simObject.getObjectId()), 0, 0,
|
static_cast<SIMCONNECT_OBJECT_ID>(simObject.getObjectId()), 0, 0,
|
||||||
sizeof(SIMCONNECT_DATA_INITPOSITION), &position);
|
sizeof(SIMCONNECT_DATA_INITPOSITION), &position);
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
|
this->rememberLastSent(result); // remember
|
||||||
if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO); }
|
if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO); }
|
||||||
this->removedClampedLog(callsign);
|
this->removedClampedLog(callsign);
|
||||||
}
|
}
|
||||||
@@ -1316,6 +1317,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
const CAircraftParts parts = result;
|
const CAircraftParts parts = result;
|
||||||
if (parts.getPartsDetails() != CAircraftParts::GuessedParts && !result.getPartsStatus().isSupportingParts()) { return false; }
|
if (parts.getPartsDetails() != CAircraftParts::GuessedParts && !result.getPartsStatus().isSupportingParts()) { return false; }
|
||||||
|
if (this->isEqualLastSent(parts, simObject.getCallsign())) { return true; }
|
||||||
|
|
||||||
DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts); // no init, all values will be set
|
DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts); // no init, all values will be set
|
||||||
return this->sendRemoteAircraftPartsToSimulator(simObject, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights());
|
return this->sendRemoteAircraftPartsToSimulator(simObject, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights());
|
||||||
@@ -1326,13 +1328,6 @@ namespace BlackSimPlugin
|
|||||||
Q_ASSERT(m_hSimConnect);
|
Q_ASSERT(m_hSimConnect);
|
||||||
const DWORD objectId = simObject.getObjectId();
|
const DWORD objectId = simObject.getObjectId();
|
||||||
|
|
||||||
// same as in simulator or same as already send to simulator?
|
|
||||||
const CAircraftLights sentLights(simObject.getLightsAsSent());
|
|
||||||
if (simObject.getPartsAsSent() == ddRemoteAircraftPartsWithoutLights && sentLights == lights)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// in case we sent, we sent everything
|
// in case we sent, we sent everything
|
||||||
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftParts,
|
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftParts,
|
||||||
objectId, SIMCONNECT_DATA_SET_FLAG_DEFAULT, 0,
|
objectId, SIMCONNECT_DATA_SET_FLAG_DEFAULT, 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user