From 5ad9c9c30bd5dd10b1d3cc598b89f305a55a21eb Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sat, 27 Sep 2014 23:37:32 +0200 Subject: [PATCH] refs #332 Add slew mode position packet to FS9 SDK --- src/plugins/simulator/fs9/fs9.h | 21 ++++++++++++- .../simulator/fs9/multiplayer_packets.h | 31 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/plugins/simulator/fs9/fs9.h b/src/plugins/simulator/fs9/fs9.h index 67720c231..ec1d7f57f 100644 --- a/src/plugins/simulator/fs9/fs9.h +++ b/src/plugins/simulator/fs9/fs9.h @@ -46,6 +46,7 @@ namespace BlackSimPlugin MULTIPLAYER_PACKET_ID_BASE = 0x1000, MULTIPLAYER_PACKET_ID_PARAMS = MULTIPLAYER_PACKET_ID_BASE, MULTIPLAYER_PACKET_ID_CHANGE_PLAYER_PLANE = 0x1003, + MULTIPLAYER_PACKET_ID_POSITION_SLEWMODE = 0x100C, MULTIPLAYER_PACKET_ID_POSITION_VELOCITY = 0x100D, MPCHAT_PACKET_ID_CHAT_TEXT_SEND = 0x1017, }; @@ -147,7 +148,25 @@ namespace BlackSimPlugin quint16 alt_f = 0; //!< Altitude value - decimal part }; - //! Full pultiplayer position and velocity packet + //! Multiplayer position packet in slew mode + struct MULTIPLAYER_PACKET_POSITION_SLEWMODE + { + MULTIPLAYER_PACKET_POSITION_SLEWMODE() {} + + quint32 application_time = 0; //!< Application time - ignored + quint32 packet_index = 0; //!< Packet index + std::array reserved = std::array{{0, 0, 0, 0}}; //!< Reserved + qint32 pbh = 0; //!< Pitch/Bank/Heading + qint32 lat_i = 0; //!< Latitude - integer + qint32 lon_hi = 0; //!< Longitude - integer + qint32 alt_i = 0; //!< Altitude - integer + quint16 lat_f = 0; //!< Latitude - fraction + quint16 lon_lo = 0; //!< Longitude - fraction + quint16 alt_f = 0; //!< Altitude - fraction + std::array unknown = std::array{{0, 0}}; //!< Unknown packet + }; + + //! Full multiplayer position and velocity packet struct MULTIPLAYER_PACKET_POSITION_VELOCITY { MULTIPLAYER_PACKET_POSITION_VELOCITY() {} diff --git a/src/plugins/simulator/fs9/multiplayer_packets.h b/src/plugins/simulator/fs9/multiplayer_packets.h index ced86aeef..bf8150222 100644 --- a/src/plugins/simulator/fs9/multiplayer_packets.h +++ b/src/plugins/simulator/fs9/multiplayer_packets.h @@ -95,6 +95,37 @@ namespace BlackSimPlugin qint32 size() { return chat_data.size() + 1; } }; + //! Multiplayer packet in slew mode + struct MPPositionSlewMode : public MULTIPLAYER_PACKET_POSITION_SLEWMODE + { + //! Return tuple of member variables + std::tuple getTuple() + { + return std::tie(application_time, packet_index, + reserved[0], reserved[1], reserved[2], reserved[3], + pbh, lat_i, lon_hi, alt_i, + lat_f, lon_lo, alt_f); + } + + //! Return const tuple of member variables + std::tuple getTuple() const + { + return std::tie(application_time, packet_index, + reserved[0], reserved[1], reserved[2], reserved[3], + pbh, lat_i, lon_hi, alt_i, + lat_f, lon_lo, alt_f); + } + + //! Struct size + qint32 size() { return 36; } + }; + //! Multiplayer packet - position and velocity struct MPPositionVelocity : public MULTIPLAYER_PACKET_POSITION_VELOCITY {