mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
Ref T229, track sent position in SimObject
This commit is contained in:
@@ -69,6 +69,24 @@ namespace BlackSimPlugin
|
|||||||
m_partsAsSent = dd;
|
m_partsAsSent = dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSimConnectObject::isSameAsSent(const SIMCONNECT_DATA_INITPOSITION &position) const
|
||||||
|
{
|
||||||
|
return std::tie(m_positionAsSent.Airspeed, m_positionAsSent.Altitude, m_positionAsSent.Bank, m_positionAsSent.Heading, m_positionAsSent.Latitude, m_positionAsSent.Longitude, m_positionAsSent.Pitch, m_positionAsSent.OnGround) ==
|
||||||
|
std::tie(position.Airspeed, position.Altitude, position.Bank, position.Heading, position.Latitude, position.Longitude, position.Pitch, position.OnGround);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimConnectObject::invalidatePositionAsSent()
|
||||||
|
{
|
||||||
|
m_positionAsSent.Airspeed = 0;
|
||||||
|
m_positionAsSent.Altitude = -1;
|
||||||
|
m_positionAsSent.Bank = -1;
|
||||||
|
m_positionAsSent.Heading = -1;
|
||||||
|
m_positionAsSent.Latitude = -1;
|
||||||
|
m_positionAsSent.Longitude = -1;
|
||||||
|
m_positionAsSent.OnGround = 0;
|
||||||
|
m_positionAsSent.Pitch = -1;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimConnectObject::setObjectId(DWORD id)
|
void CSimConnectObject::setObjectId(DWORD id)
|
||||||
{
|
{
|
||||||
m_objectId = id;
|
m_objectId = id;
|
||||||
@@ -104,12 +122,13 @@ namespace BlackSimPlugin
|
|||||||
m_confirmedAdded = false;
|
m_confirmedAdded = false;
|
||||||
m_currentLightsInSim = CAircraftLights();
|
m_currentLightsInSim = CAircraftLights();
|
||||||
m_lightsAsSent = CAircraftLights();
|
m_lightsAsSent = CAircraftLights();
|
||||||
m_partsAsSent = DataDefinitionRemoteAircraftPartsWithoutLights {}; // init with 0s
|
|
||||||
m_requestId = -1;
|
m_requestId = -1;
|
||||||
m_objectId = -1;
|
m_objectId = -1;
|
||||||
m_lightsRequestedAt = -1;
|
m_lightsRequestedAt = -1;
|
||||||
m_validRequestId = false;
|
m_validRequestId = false;
|
||||||
m_validObjectId = false;
|
m_validObjectId = false;
|
||||||
|
this->invalidatePartsAsSent();
|
||||||
|
this->invalidatePositionAsSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimConnectObject::hasValidRequestAndObjectId() const
|
bool CSimConnectObject::hasValidRequestAndObjectId() const
|
||||||
|
|||||||
@@ -81,6 +81,18 @@ namespace BlackSimPlugin
|
|||||||
//! Invalidate parts as sent
|
//! Invalidate parts as sent
|
||||||
void invalidatePartsAsSent();
|
void invalidatePartsAsSent();
|
||||||
|
|
||||||
|
//! Parts as sent to simulator
|
||||||
|
const SIMCONNECT_DATA_INITPOSITION &getPositionAsSent() const { return m_positionAsSent; }
|
||||||
|
|
||||||
|
//! Position as sent
|
||||||
|
void setPositionAsSent(const SIMCONNECT_DATA_INITPOSITION &position) { m_positionAsSent = position; }
|
||||||
|
|
||||||
|
//! Same as sent
|
||||||
|
bool isSameAsSent(const SIMCONNECT_DATA_INITPOSITION &position) const;
|
||||||
|
|
||||||
|
//! Invalidate position as sent;
|
||||||
|
void invalidatePositionAsSent();
|
||||||
|
|
||||||
//! Lights as sent to simulator
|
//! Lights as sent to simulator
|
||||||
const BlackMisc::Aviation::CAircraftLights &getLightsAsSent() const { return m_lightsAsSent; }
|
const BlackMisc::Aviation::CAircraftLights &getLightsAsSent() const { return m_lightsAsSent; }
|
||||||
|
|
||||||
@@ -172,6 +184,7 @@ namespace BlackSimPlugin
|
|||||||
bool m_pendingRemoved = false;
|
bool m_pendingRemoved = false;
|
||||||
int m_lightsRequestedAt = -1;
|
int m_lightsRequestedAt = -1;
|
||||||
DataDefinitionRemoteAircraftPartsWithoutLights m_partsAsSent {}; //!< parts as sent
|
DataDefinitionRemoteAircraftPartsWithoutLights m_partsAsSent {}; //!< parts as sent
|
||||||
|
SIMCONNECT_DATA_INITPOSITION m_positionAsSent {}; //!< position as sent
|
||||||
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
BlackMisc::Aviation::CAircraftLights m_currentLightsInSim { nullptr }; //!< current lights to know state for toggling
|
||||||
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
BlackMisc::Aviation::CAircraftLights m_lightsAsSent { nullptr }; //!< lights as sent to simulator
|
||||||
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
SIMCONNECT_PERIOD m_requestSimDataPeriod = SIMCONNECT_PERIOD_NEVER; //!< how often do we query ground elevation
|
||||||
|
|||||||
Reference in New Issue
Block a user