mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +08:00
[FS9] Send position and params update right after client is connected
This commit is contained in:
committed by
Mat Sutcliffe
parent
e0fe7ab1d0
commit
464528da9a
@@ -189,16 +189,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
|
||||||
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
|
sendMultiplayerPosition();
|
||||||
if (m_clientStatus == Disconnected) { return; }
|
|
||||||
const bool forceFullUpdate = false;
|
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign, forceFullUpdate);
|
|
||||||
const CInterpolationResult result = m_interpolator.getInterpolation(QDateTime::currentMSecsSinceEpoch(), setup, 0);
|
|
||||||
|
|
||||||
// Test only for successful position. FS9 requires constant positions
|
|
||||||
if (!result.getInterpolationStatus().hasValidSituation()) { return; }
|
|
||||||
|
|
||||||
sendMultiplayerPosition(result);
|
|
||||||
sendMultiplayerParamaters();
|
sendMultiplayerParamaters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +309,8 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
CLogMessage(this).debug() << m_callsign << " connected to session.";
|
CLogMessage(this).debug() << m_callsign << " connected to session.";
|
||||||
sendMultiplayerChangePlayerPlane();
|
sendMultiplayerChangePlayerPlane();
|
||||||
|
sendMultiplayerPosition();
|
||||||
|
sendMultiplayerParamaters();
|
||||||
m_timerId = startTimer(m_updateInterval.valueInteger(CTimeUnit::ms()));
|
m_timerId = startTimer(m_updateInterval.valueInteger(CTimeUnit::ms()));
|
||||||
|
|
||||||
m_clientStatus = Connected;
|
m_clientStatus = Connected;
|
||||||
@@ -343,9 +335,18 @@ namespace BlackSimPlugin
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFs9Client::sendMultiplayerPosition(const CAircraftSituation &situation)
|
void CFs9Client::sendMultiplayerPosition()
|
||||||
{
|
{
|
||||||
MPPositionSlewMode positionSlewMode = aircraftSituationToFS9(situation);
|
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
|
||||||
|
if (m_clientStatus == Disconnected) { return; }
|
||||||
|
const bool forceFullUpdate = false;
|
||||||
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupConsolidated(m_callsign, forceFullUpdate);
|
||||||
|
const CInterpolationResult result = m_interpolator.getInterpolation(QDateTime::currentMSecsSinceEpoch(), setup, 0);
|
||||||
|
|
||||||
|
// Test only for successful position. FS9 requires constant positions
|
||||||
|
if (!result.getInterpolationStatus().hasValidSituation()) { return; }
|
||||||
|
|
||||||
|
MPPositionSlewMode positionSlewMode = aircraftSituationToFS9(result.getInterpolatedSituation());
|
||||||
|
|
||||||
QByteArray positionMessage;
|
QByteArray positionMessage;
|
||||||
MultiPlayerPacketParser::writeType(positionMessage, CFs9Sdk::MULTIPLAYER_PACKET_ID_POSITION_SLEWMODE);
|
MultiPlayerPacketParser::writeType(positionMessage, CFs9Sdk::MULTIPLAYER_PACKET_ID_POSITION_SLEWMODE);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
//! Send functions
|
//! Send functions
|
||||||
//! @{
|
//! @{
|
||||||
void sendMultiplayerPosition(const BlackMisc::Aviation::CAircraftSituation &situation);
|
void sendMultiplayerPosition();
|
||||||
void sendMultiplayerParamaters();
|
void sendMultiplayerParamaters();
|
||||||
void sendMultiplayerChangePlayerPlane();
|
void sendMultiplayerChangePlayerPlane();
|
||||||
//! @}
|
//! @}
|
||||||
|
|||||||
Reference in New Issue
Block a user