1 // multiplaytxmgr.hxx -- routines for transmitting multiplayer data
4 // Written by Duncan McCreanor, started February 2003.
5 // duncan.mccreanor@airservicesaustralia.com
7 // Copyright (C) 2003 Airservices Australia
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef MULTIPLAYTXMGR_H
25 #define MULTIPLAYTXMGR_H
27 #define MULTIPLAYTXMGR_HID "$Id$"
30 #include "mpplayer.hxx"
31 #include "mpmessages.hxx"
40 #include <simgear/compiler.h>
41 #include <plib/netSocket.h>
43 // Maximum number of players that can exist at any time
44 #define MAX_PLAYERS 10
46 /****************************************************************
49 * Description: The multiplay tx manager is responsible for
50 * sending data to another player or a multiplayer server.
52 * The position information for the local player is transmitted
53 * on each call to SendMyPosition.
55 *******************************************************************/
56 class FGMultiplayTxMgr {
65 /** Initialises the multiplayer transmitter.
66 * @return True if initialisation succeeds, else false
70 /** Sends the position data for the local player
71 * @param PlayerPosMat4 Transformation matrix for the player's position
73 void SendMyPosition(const sgMat4 PlayerPosMat4);
75 /** Sends a tex chat message.
76 * @param sMsgText Message text to send
78 void SendTextMessage(const string &sMsgText) const;
80 /** Closes the multiplayer manager. Stops any further player packet processing.
87 /** The local player */
88 MPPlayer *mLocalPlayer;
90 /** Socket for sending to the server or another player if playing point to point */
91 netSocket *mDataTxSocket;
93 /** True if multiplay transmit is initialised */