]> git.mxchange.org Git - flightgear.git/blob - src/MultiPlayer/multiplaytxmgr.hxx
Moved random ground cover object management code (userdata.[ch]xx) over
[flightgear.git] / src / MultiPlayer / multiplaytxmgr.hxx
1 // multiplaytxmgr.hxx -- routines for transmitting multiplayer data
2 //                       for Flghtgear
3 //
4 // Written by Duncan McCreanor, started February 2003.
5 // duncan.mccreanor@airservicesaustralia.com
6 //
7 // Copyright (C) 2003  Airservices Australia
8 //
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.
13 //
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.
18 //
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.
22 //
23
24 #ifndef MULTIPLAYTXMGR_H
25 #define MULTIPLAYTXMGR_H
26
27 #define MULTIPLAYTXMGR_HID "$Id$"
28
29
30 #include "mpplayer.hxx"
31 #include "mpmessages.hxx"
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #include STL_STRING
38 SG_USING_STD(string);
39
40 #include <simgear/compiler.h>
41 #include <plib/ssg.h>
42 #include <plib/netSocket.h>
43
44 // Maximum number of players that can exist at any time
45 #define MAX_PLAYERS 10
46
47 /****************************************************************
48 * @version $Id$
49 *
50 * Description: The multiplay tx manager is responsible for
51 * sending data to another player or a multiplayer server.
52 *
53 * The position information for the local player is transmitted
54 * on each call to SendMyPosition.
55 *
56 *******************************************************************/
57 class FGMultiplayTxMgr {
58 public:
59
60     /** Constructor */
61     FGMultiplayTxMgr();
62
63     /** Destructor. */
64     ~FGMultiplayTxMgr();
65
66     /** Initialises the multiplayer transmitter.
67     * @return True if initialisation succeeds, else false
68     */
69     bool init(void);
70
71     /** Sends the position data for the local player
72     * @param PlayerPosMat4 Transformation matrix for the player's position
73     */
74     void SendMyPosition(const sgMat4 PlayerPosMat4);
75     
76     /** Sends a tex chat message.
77     * @param sMsgText Message text to send
78     */
79     void SendTextMessage(const string &sMsgText) const;
80
81     /** Closes the multiplayer manager. Stops any further player packet processing.
82     */
83     void Close(void);
84
85
86 private:
87
88     /** The local player */
89     MPPlayer *mLocalPlayer;
90
91     /** Socket for sending to the server or another player if playing point to point */
92     netSocket *mDataTxSocket;
93
94     /** True if multiplay transmit is initialised */
95     bool m_bInitialised;
96
97 };
98
99 #endif
100
101
102