]> git.mxchange.org Git - flightgear.git/blobdiff - src/MultiPlayer/multiplaymgr.hxx
Fixed an property tieing issue on sim reset.
[flightgear.git] / src / MultiPlayer / multiplaymgr.hxx
index eb5fc1edf004bda1570503d828a03c1ced3c3c94..8475c0ef125df219c672f690f1521daf4e373a5d 100644 (file)
@@ -1,6 +1,6 @@
 //////////////////////////////////////////////////////////////////////
 //
-// multiplaymgr.hpp
+// multiplaymgr.hxx
 //
 // Written by Duncan McCreanor, started February 2003.
 // duncan.mccreanor@airservicesaustralia.com
 
 #include "mpmessages.hxx"
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <string>
-using std::string;
 #include <vector>
-using std::vector;
 
 #include <simgear/compiler.h>
 #include <simgear/props/props.hxx>
-#include <plib/netSocket.h>
 #include <Main/globals.hxx>
+#include <simgear/io/raw_socket.hxx>
+#include <simgear/structure/subsystem_mgr.hxx>
 
 #include <AIModel/AIMultiplayer.hxx>
 
 struct FGExternalMotionInfo;
 
-class FGMultiplayMgr 
+class FGMultiplayMgr : public SGSubsystem
 {
 public:
 
@@ -67,13 +62,15 @@ public:
   
   FGMultiplayMgr();
   ~FGMultiplayMgr();
-  bool init(void);
+  
+  virtual void init(void);
+  virtual void update(double dt);
+  
   void Close(void);
   // transmitter
   void SendMyPosition(const FGExternalMotionData& motionInfo);
   void SendTextMessage(const string &sMsgText);
   // receiver
-  void Update(void);
   
 private:
   union MsgBuf;
@@ -81,19 +78,20 @@ private:
                                   const std::string& modelName);
   FGAIMultiplayer* getMultiplayer(const std::string& callsign);
   void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
-  void ProcessPosMsg(const MsgBuf& Msg, const netAddress& SenderAddress,
+  void ProcessPosMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress,
                      long stamp);
-  void ProcessChatMsg(const MsgBuf& Msg, const netAddress& SenderAddress);
+  void ProcessChatMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress);
+  bool isSane(const FGExternalMotionData& motionInfo);
 
   /// maps from the callsign string to the FGAIMultiplayer
   typedef std::map<std::string, SGSharedPtr<FGAIMultiplayer> > MultiPlayerMap;
   MultiPlayerMap mMultiPlayerMap;
 
-  netSocket* mSocket;
-  netAddress mServer;
+  simgear::Socket* mSocket;
+  simgear::IPAddress mServer;
   bool mHaveServer;
   bool mInitialised;
-  string mCallsign;
+  std::string mCallsign;
 };
 
 #endif