]> git.mxchange.org Git - flightgear.git/blobdiff - src/MultiPlayer/mpmessages.hxx
Portability fix - use SimGear when available
[flightgear.git] / src / MultiPlayer / mpmessages.hxx
index 65d00011a52fa948970521ee03cb3fdf01803d55..0e6b9468ff1d9eab1fa4b3788b648a50a6c1328b 100644 (file)
@@ -4,6 +4,8 @@
 // Written by Duncan McCreanor, started February 2003.
 // duncan.mccreanor@airservicesaustralia.com
 //
+// With minor additions be Vivian Meazza, January 2006
+//
 // Copyright (C) 2003  Airservices Australia
 //
 // This program is free software; you can redistribute it and/or
@@ -35,9 +37,9 @@
 *
 ******************************************************************/
 
-#include <simgear/compiler.h>
-#include "tiny_xdr.hpp"
 #include <plib/sg.h>
+#include <simgear/compiler.h>
+#include "tiny_xdr.hxx"
 
 // magic value for messages
 const uint32_t MSG_MAGIC = 0x46474653;  // "FGFS"
@@ -47,14 +49,17 @@ const uint32_t PROTO_VER = 0x00010001;  // 1.1
 // Message identifiers
 #define CHAT_MSG_ID             1
 #define UNUSABLE_POS_DATA_ID    2
-#define POS_DATA_ID             3
+#define OLD_POS_DATA_ID         3
+#define POS_DATA_ID             4
+#define PROP_MSG_ID             5
 
 // XDR demands 4 byte alignment, but some compilers use8 byte alignment
-// so it's safe to let the overall size of a netmork message be a 
+// so it's safe to let the overall size of a network message be a 
 // multiple of 8!
 #define MAX_CALLSIGN_LEN        8
-#define MAX_CHAT_MSG_LEN        48
-#define MAX_MODEL_NAME_LEN      48
+#define MAX_CHAT_MSG_LEN        256
+#define MAX_MODEL_NAME_LEN      96
+#define MAX_PROPERTY_LEN        52
 
 /** Aircraft position message */
 typedef xdr_data2_t xdrPosition[3];
@@ -66,24 +71,55 @@ public:
     xdr_data_t  Magic;                  // Magic Value
     xdr_data_t  Version;                // Protocoll version
     xdr_data_t  MsgId;                  // Message identifier 
-    xdr_data_t  iMsgLen;                // absolue length of message
-    xdr_data_t  lReplyAddress;          // (player's receiver address
-    xdr_data_t  iReplyPort;             // player's receiver port
-    char sCallsign[MAX_CALLSIGN_LEN];   // Callsign used by the player
+    xdr_data_t  MsgLen;                 // absolute length of message
+    xdr_data_t  ReplyAddress;           // (player's receiver address
+    xdr_data_t  ReplyPort;              // player's receiver port
+    char Callsign[MAX_CALLSIGN_LEN];    // Callsign used by the player
 };
 
 // Chat message 
 class T_ChatMsg {
 public:    
-    char sText[MAX_CHAT_MSG_LEN];       // Text of chat message
+    char Text[MAX_CHAT_MSG_LEN];       // Text of chat message
 };
 
 // Position message
 class T_PositionMsg {
 public:
-    char sModel[MAX_MODEL_NAME_LEN];    // Name of the aircraft model
-    xdrPosition     PlayerPosition;     // players position
-    xdrOrientation  PlayerOrientation;  // players orientation
+    char Model[MAX_MODEL_NAME_LEN];    // Name of the aircraft model
+    xdr_data_t  time;                  // Time when this packet was generated
+    xdr_data_t  timeusec;              // Microsecs when this packet was generated
+    xdr_data2_t lat;                   // Position, orientation, speed
+    xdr_data2_t lon;                   // ...
+    xdr_data2_t alt;                   // ...
+    xdr_data2_t hdg;                   // ...
+    xdr_data2_t roll;                  // ...
+    xdr_data2_t pitch;                 // ...
+    xdr_data2_t speedN;                // ...
+    xdr_data2_t speedE;                // ...
+    xdr_data2_t speedD;                // ...
+       xdr_data_t  accN;                                  // acceleration N
+       xdr_data_t  accE;                  // acceleration E
+       xdr_data_t  accD;                  // acceleration D
+    xdr_data_t  left_aileron;          // control positions
+    xdr_data_t  right_aileron;         // control positions
+    xdr_data_t  elevator;              // ...
+    xdr_data_t  rudder;                // ...
+//    xdr_data_t  rpms[6];               // RPMs of all of the motors
+    xdr_data_t  rateH;                 // Rate of change of heading
+    xdr_data_t  rateR;                 // roll
+    xdr_data_t  rateP;                 // and pitch
+//     xdr_data_t  dummy;                 // pad message length
+};
+
+// Property message
+class T_PropertyMsg {
+public:
+    char property[MAX_PROPERTY_LEN];   // the property name
+    xdr_data_t  type;                                  // the type
+    xdr_data2_t val;                                   // and value
+//     xdr_data2_t dummy;                                      // pad message length
+       
 };
 
 #endif