]> git.mxchange.org Git - flightgear.git/blob - src/MultiPlayer/multiplaytxmgr.hxx
Remove unnecessary inclusions of sg.h ans ssg.h
[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/netSocket.h>
42
43 // Maximum number of players that can exist at any time
44 #define MAX_PLAYERS 10
45
46 /****************************************************************
47 * @version $Id$
48 *
49 * Description: The multiplay tx manager is responsible for
50 * sending data to another player or a multiplayer server.
51 *
52 * The position information for the local player is transmitted
53 * on each call to SendMyPosition.
54 *
55 *******************************************************************/
56 class FGMultiplayTxMgr {
57 public:
58
59     /** Constructor */
60     FGMultiplayTxMgr();
61
62     /** Destructor. */
63     ~FGMultiplayTxMgr();
64
65     /** Initialises the multiplayer transmitter.
66     * @return True if initialisation succeeds, else false
67     */
68     bool init(void);
69
70     /** Sends the position data for the local player
71     * @param PlayerPosMat4 Transformation matrix for the player's position
72     */
73     void SendMyPosition(const sgMat4 PlayerPosMat4);
74     
75     /** Sends a tex chat message.
76     * @param sMsgText Message text to send
77     */
78     void SendTextMessage(const string &sMsgText) const;
79
80     /** Closes the multiplayer manager. Stops any further player packet processing.
81     */
82     void Close(void);
83
84
85 private:
86
87     /** The local player */
88     MPPlayer *mLocalPlayer;
89
90     /** Socket for sending to the server or another player if playing point to point */
91     netSocket *mDataTxSocket;
92
93     /** True if multiplay transmit is initialised */
94     bool m_bInitialised;
95
96 };
97
98 #endif
99
100
101