1 // multiplay.hxx -- protocol object for multiplay in Flightgear
3 // Written by Diarmuid Tyson, started February 2003.
4 // diarmuid.tyson@airservicesaustralia.com
6 // With additions by Vivian Meazza, January 2006
8 // Copyright (C) 2003 Airservices Australia
10 // This program is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU General Public License as
12 // published by the Free Software Foundation; either version 2 of the
13 // License, or (at your option) any later version.
15 // This program is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef _FG_MULTIPLAY_HXX
26 #define _FG_MULTIPLAY_HXX
28 #define FG_MULTIPLAY_HID "$Id$"
30 #include <simgear/compiler.h>
34 #include <simgear/props/props.hxx>
35 #include <simgear/scene/model/model.hxx>
37 #include <Main/globals.hxx>
38 #include <Main/fg_props.hxx>
39 #include <Model/acmodel.hxx>
40 #include <MultiPlayer/multiplaymgr.hxx>
42 #include "protocol.hxx"
47 /****************************************************************
50 * Description: FGMultiplay is an FGProtocol object used as the basic
51 * interface for the multiplayer code into FlightGears generic IO
52 * subsystem. It only implements the basic FGProtocol methods: open(),
53 * process() and close(). It does not use Sim Gear's IO channels, as
54 * the MultiplayMgrs creates their own sockets through plib.
56 * It will set up it's direction and rate protocol properties when
57 * created. Subsequent calls to process will prompt the
58 * MultiplayMgr to either send or receive data over the network.
60 ******************************************************************/
62 class FGMultiplay : public FGProtocol {
66 FGMultiplay (const string &dir, const int rate, const string &host, const int port);
71 /** Enables the FGMultiplay object. */
74 /** Tells the multiplayer_mgr to send/receive data.
78 /** Closes the multiplayer_mgr.
83 // Map between the property id's from the multiplayers network packets
84 // and the property nodes
85 typedef std::map<unsigned, SGSharedPtr<SGPropertyNode> > PropertyMap;
86 PropertyMap mPropertyMap;
90 #endif // _FG_MULTIPLAY_HXX