X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMultiPlayer%2Fmultiplaymgr.hxx;h=96e56f2428a29f8e56f3313650be78b978029331;hb=ad13e4f3b42c53410cb695d2dd0083af77addb2e;hp=a8c7dae2417701d0794a7b0065747eaaeb9f2b66;hpb=da6568ad50774e241d8157006a0b49baee2d8537;p=flightgear.git diff --git a/src/MultiPlayer/multiplaymgr.hxx b/src/MultiPlayer/multiplaymgr.hxx index a8c7dae24..96e56f242 100644 --- a/src/MultiPlayer/multiplaymgr.hxx +++ b/src/MultiPlayer/multiplaymgr.hxx @@ -20,7 +20,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. // // $Id$ // @@ -37,10 +37,10 @@ # include #endif -#include STL_STRING -SG_USING_STD(string); +#include +using std::string; #include -SG_USING_STD(vector); +using std::vector; #include #include @@ -54,12 +54,17 @@ struct FGExternalMotionInfo; class FGMultiplayMgr { public: + struct IdPropertyList { unsigned id; const char* name; + simgear::props::Type type; }; - static IdPropertyList sIdPropertyList[]; + static const IdPropertyList sIdPropertyList[]; + static const unsigned numProperties; + static const IdPropertyList* findProperty(unsigned id); + FGMultiplayMgr(); ~FGMultiplayMgr(); bool init(void); @@ -67,21 +72,21 @@ public: // transmitter void SendMyPosition(const FGExternalMotionData& motionInfo); void SendTextMessage(const string &sMsgText); - void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u); - // receiver - void ProcessPosMsg(const char *Msg, netAddress & SenderAddress, - unsigned len, long stamp); - void ProcessChatMsg(const char *Msg, netAddress & SenderAddress); void Update(void); private: + union MsgBuf; FGAIMultiplayer* addMultiplayer(const std::string& callsign, 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, + long stamp); + void ProcessChatMsg(const MsgBuf& Msg, const netAddress& SenderAddress); /// maps from the callsign string to the FGAIMultiplayer - typedef std::map > MultiPlayerMap; + typedef std::map > MultiPlayerMap; MultiPlayerMap mMultiPlayerMap; netSocket* mSocket;