]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/multiplay.cxx
Expose the "play-audio-command" through the props/telnet interface.
[flightgear.git] / src / Network / multiplay.cxx
index 4bc37c120acd023a07de770fe50b9bb8d9eb1404..ebf511f88554db75b784ee74f36c64724d42efa8 100644 (file)
@@ -20,6 +20,9 @@
 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 //
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <simgear/compiler.h>
 
@@ -29,6 +32,9 @@
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/scene/model/placement.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
+
+#include <Scenery/scenery.hxx>
 
 #include "multiplay.hxx"
 
@@ -101,12 +107,20 @@ bool FGMultiplay::process() {
 
   if (get_direction() == SG_IO_IN) {
 
-    globals->get_multiplayer_rx_mgr()->ProcessData();
+    globals->get_multiplayer_mgr()->ProcessData();
 
   } else if (get_direction() == SG_IO_OUT) {
 
-    globals->get_multiplayer_tx_mgr()->
-    SendMyPosition(globals->get_aircraft_model()->get3DModel()->get_POS());
+    sgMat4 posTrans;
+    globals->get_aircraft_model()->get3DModel()->getTransform()->getTransform(posTrans);
+    Point3D center = globals->get_scenery()->get_center();
+    sgdVec3 PlayerPosition;
+    sgdSetVec3(PlayerPosition, posTrans[3][0] + center[0],
+               posTrans[3][1] + center[1], posTrans[3][2] + center[2]);
+    sgQuat PlayerOrientation;
+    sgMatrixToQuat(PlayerOrientation, posTrans);
+
+    globals->get_multiplayer_mgr()->SendMyPosition(PlayerOrientation, PlayerPosition);
 
   }
 
@@ -123,11 +137,11 @@ bool FGMultiplay::close() {
 
   if (get_direction() == SG_IO_IN) {
 
-    globals->get_multiplayer_rx_mgr()->Close();
+    globals->get_multiplayer_mgr()->Close();
 
   } else if (get_direction() == SG_IO_OUT) {
 
-    globals->get_multiplayer_tx_mgr()->Close();
+//    globals->get_multiplayer_mgr()->Close();
 
   }