blob: 19e5afab17a890e867592278caf5d683158313e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#ifndef E_SIMPLAYERINFO_H_
#define E_SIMPLAYERINFO_H_
// class holding all simulation specific player information -------------------
//
class E_SimPlayerInfo
{
protected:
int m_Status; // status of the player (inactive,connected,joined)
int m_objclass; // the objectclass selected as ship when joined
ShipObject* m_pShip;
int m_nShipID;
int m_nClientID;
int m_IgnoreJoinUntilUnjoinFromClient;
public:
E_SimPlayerInfo()
{
Reset();
}
// reset all player fields to defaults ( not connected )
void Reset();
// check whether a player is disconnected
bool_t IsPlayerDisconnected() { return ( m_Status == PLAYER_INACTIVE ); }
// check whether a player is connected
bool_t IsPlayerConnected() { return ( m_Status == PLAYER_CONNECTED ); }
// check whether a player is joined in the game
bool_t IsPlayerJoined() { return ( m_Status == PLAYER_JOINED ); }
// set the desired player status ( inactive/joined/unjoined )
void SetDesiredPlayerStatus( RE_PlayerStatus* playerstatus );
// update tables and create ship for newly joined player
void PerformJoin( RE_PlayerStatus* pas_status );
// update tables and delete ship of player who unjoined
void PerformUnjoin( RE_PlayerStatus* playerstatus );
// set the player status to connected
void Connect( int nClientID );
// set the player status to disconnected
void Disconnect();
// set flag to ignore all joins until we get an unjoin from the client
void IgnoreJoinUntilUnjoinFromClient()
{
m_IgnoreJoinUntilUnjoinFromClient = TRUE;
}
// get a pointer to the ship object
ShipObject* GetShipObject() { return m_pShip; }
// get the object class of the ship
int GetShipObjectClass() { return m_objclass; }
// return the status of the player
int GetStatus() { return m_Status; }
};
#endif // E_SIMPLAYERINFO_H_
|