1 //////////////////////////////////////////////////////////////////////
5 // Written by Duncan McCreanor, started February 2003.
6 // duncan.mccreanor@airservicesaustralia.com
8 // Copyright (C) 2003 Airservices Australia
9 // Copyright (C) 2005 Oliver Schroeder
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License as
13 // published by the Free Software Foundation; either version 2 of the
14 // License, or (at your option) any later version.
16 // This program is distributed in the hope that it will be useful, but
17 // WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 //////////////////////////////////////////////////////////////////////
29 #ifndef MULTIPLAYMGR_H
30 #define MULTIPLAYMGR_H
32 #define MULTIPLAYTXMGR_HID "$Id$"
34 #include "mpmessages.hxx"
45 #include <simgear/compiler.h>
46 #include <simgear/props/props.hxx>
47 #include <plib/netSocket.h>
48 #include <Main/globals.hxx>
50 #include <AIModel/AIMultiplayer.hxx>
52 struct FGExternalMotionInfo;
58 struct IdPropertyList {
61 SGPropertyNode::Type type;
63 static const IdPropertyList sIdPropertyList[];
64 static const unsigned numProperties;
66 static const IdPropertyList* findProperty(unsigned id);
73 void SendMyPosition(const FGExternalMotionData& motionInfo);
74 void SendTextMessage(const string &sMsgText);
80 FGAIMultiplayer* addMultiplayer(const std::string& callsign,
81 const std::string& modelName);
82 FGAIMultiplayer* getMultiplayer(const std::string& callsign);
83 void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
84 void ProcessPosMsg(const MsgBuf& Msg, const netAddress& SenderAddress,
86 void ProcessChatMsg(const MsgBuf& Msg, const netAddress& SenderAddress);
88 /// maps from the callsign string to the FGAIMultiplayer
89 typedef std::map<std::string, osg::ref_ptr<FGAIMultiplayer> > MultiPlayerMap;
90 MultiPlayerMap mMultiPlayerMap;