mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
[FS9] Preparation for sending parts
* function sendMultiplayerPositionAndPartsFromInterpolation sending parts and positions * bogus function MPParam aircraftPartsToFS9 (needs to be implemented) * changed to sendMultiplayerParts(const CAircraftParts &parts) - like for positions * fixed some smaller bugs
This commit is contained in:
committed by
Mat Sutcliffe
parent
e91b88691a
commit
8f5e24fe0b
@@ -194,9 +194,7 @@ namespace BlackSimPlugin
|
||||
void CFs9Client::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
sendMultiplayerPosition();
|
||||
sendMultiplayerParamaters();
|
||||
sendMultiplayerPositionAndPartsFromInterpolation();
|
||||
}
|
||||
|
||||
HRESULT CFs9Client::enumDirectPlayHosts()
|
||||
@@ -325,7 +323,7 @@ namespace BlackSimPlugin
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CFs9Client::sendMultiplayerPosition()
|
||||
void CFs9Client::sendMultiplayerPositionAndPartsFromInterpolation()
|
||||
{
|
||||
// remark: in FS9 there is no central updateRemoteAircraft() function, each FS9 client updates itself
|
||||
if (m_clientStatus == Disconnected) { return; }
|
||||
@@ -336,6 +334,7 @@ namespace BlackSimPlugin
|
||||
// Test only for successful position. FS9 requires constant positions
|
||||
if (!result.getInterpolationStatus().hasValidSituation()) { return; }
|
||||
this->sendMultiplayerPosition(result.getInterpolatedSituation());
|
||||
this->sendMultiplayerParts(result.getInterpolatedParts());
|
||||
}
|
||||
|
||||
void CFs9Client::sendMultiplayerPosition(const CAircraftSituation &situation)
|
||||
@@ -352,15 +351,20 @@ namespace BlackSimPlugin
|
||||
sendMessage(positionMessage);
|
||||
}
|
||||
|
||||
MPParam aircraftPartsToFS9(const CAircraftParts &parts)
|
||||
{
|
||||
//! todo THAT PART IS MISSING HERE, see https://discordapp.com/channels/539048679160676382/539925070550794240/699234172849618975
|
||||
Q_UNUSED(parts)
|
||||
MPParam param;
|
||||
return param;
|
||||
}
|
||||
|
||||
void CFs9Client::sendMultiplayerParts(const CAircraftParts &parts)
|
||||
{
|
||||
Q_UNUSED(parts)
|
||||
}
|
||||
|
||||
void CFs9Client::sendMultiplayerParamaters()
|
||||
{
|
||||
QByteArray paramMessage;
|
||||
MPParam param;
|
||||
MPParam param = aircraftPartsToFS9(parts);
|
||||
|
||||
MultiPlayerPacketParser::writeType(paramMessage, CFs9Sdk::MULTIPLAYER_PACKET_ID_PARAMS);
|
||||
MultiPlayerPacketParser::writeSize(paramMessage, param.size());
|
||||
param.packet_index = m_packetIndex;
|
||||
@@ -397,12 +401,11 @@ namespace BlackSimPlugin
|
||||
void CFs9Client::handleConnectionCompleted()
|
||||
{
|
||||
CLogMessage(this).info(u"Callsign '%1' connected to session.") << m_callsign;
|
||||
sendMultiplayerChangePlayerPlane();
|
||||
sendMultiplayerPosition();
|
||||
sendMultiplayerParamaters();
|
||||
m_timerId = startTimer(m_updateInterval.valueInteger(CTimeUnit::ms()));
|
||||
|
||||
m_clientStatus = Connected;
|
||||
m_clientStatus = Connected; // will not send position in disconnected mode
|
||||
sendMultiplayerChangePlayerPlane();
|
||||
sendMultiplayerPositionAndPartsFromInterpolation();
|
||||
|
||||
emit statusChanged(m_remoteAircraft, m_clientStatus);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +92,7 @@ namespace BlackSimPlugin
|
||||
|
||||
//! Send functions
|
||||
//! @{
|
||||
void sendMultiplayerPosition();
|
||||
void sendMultiplayerParamaters();
|
||||
void sendMultiplayerPositionAndPartsFromInterpolation();
|
||||
void sendMultiplayerChangePlayerPlane();
|
||||
//! @}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user