]> git.mxchange.org Git - flightgear.git/blobdiff - src/MultiPlayer/mpmessages.hxx
Sync. w. JSBSim CVS
[flightgear.git] / src / MultiPlayer / mpmessages.hxx
index 523c555c69304c587522a458f1201382450d91d6..352eb576535a4495bd8aa92a081bd57f58c3a305 100644 (file)
@@ -18,7 +18,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 
 #ifndef MPMESSAGES_H
@@ -37,8 +37,8 @@
 
 #include <vector>
 
-#include <plib/sg.h>
 #include <simgear/compiler.h>
+#include <simgear/props/props.hxx>
 #include <simgear/math/SGMath.hxx>
 #include "tiny_xdr.hxx"
 
@@ -107,19 +107,35 @@ struct T_PositionMsg {
     // angular acceleration wrt the earth centered frame measured in
     // the earth centered frame
     xdr_data_t angularAccel[3];
+    // Padding. The alignment is 8 bytes on x86_64 because there are
+    // 8-byte types in the message, so the size should be explicitly
+    // rounded out to a multiple of 8. Of course, it's a bad idea to
+    // put a C struct directly on the wire, but that's a fight for
+    // another day...
+    xdr_data_t pad;
 };
 
-// Property message
-struct T_PropertyMsg {
-    xdr_data_t id;
-    xdr_data_t value;
-};
-
-struct FGFloatPropertyData {
+struct FGPropertyData {
   unsigned id;
-  float value;
+  
+  // While the type isn't transmitted, it is needed for the destructor
+  SGPropertyNode::Type type;
+  union { 
+    int int_value;
+    float float_value;
+    char* string_value;
+  }; 
+  
+  ~FGPropertyData() {
+    if ((type == SGPropertyNode::STRING) || (type == SGPropertyNode::UNSPECIFIED))
+    {
+      delete [] string_value;
+    }
+  }
 };
 
+
+
 // Position message
 struct FGExternalMotionData {
   // simulation time when this packet was generated
@@ -149,7 +165,7 @@ struct FGExternalMotionData {
   SGVec3f angularAccel;
   
   // The set of properties recieved for this timeslot
-  std::vector<FGFloatPropertyData> properties;
+  std::vector<FGPropertyData*> properties;
 };
 
 #endif