Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetUser.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: NetUser.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  This class represents a user connecting to the multiplayer lobby
13 */
14 
15 
16 #ifndef NetUser_h
17 #define NetUser_h
18 
19 #include "Types.h"
20 #include "NetAddr.h"
21 #include "NetLobby.h"
22 #include "Color.h"
23 
24 // +-------------------------------------------------------------------+
25 
26 class Player;
27 
28 // +-------------------------------------------------------------------+
29 
30 class NetUser
31 {
32 public:
33  static const char* TYPENAME() { return "NetUser"; }
34 
35  NetUser(const char* name);
36  NetUser(const Player* player);
37  virtual ~NetUser();
38 
39  int operator == (const NetUser& u) const { return this == &u; }
40 
41  const Text& Name() const { return name; }
42  const Text& Pass() const { return pass; }
43  const NetAddr& GetAddress() const { return addr; }
44  Color GetColor() const { return color; }
45  const Text& GetSessionID() const { return session_id; }
46  DWORD GetNetID() const { return netid; }
47  bool IsHost() const { return host; }
48 
49  int AuthLevel() const { return auth_level; }
50  int AuthState() const { return auth_state; }
51  const char* Salt() const { return salt; }
52  bool IsAuthOK() const;
53 
54  const Text& Squadron() const { return squadron; }
55  const Text& Signature() const { return signature; }
56  int Rank() const { return rank; }
57  int FlightTime() const { return flight_time; }
58  int Missions() const { return missions; }
59  int Kills() const { return kills; }
60  int Losses() const { return losses; }
61 
62  void SetName(const char* n) { name = n; }
63  void SetPass(const char* p) { pass = p; }
64  void SetAddress(const NetAddr& a)
65  { addr = a; }
66 
67  void SetColor(Color c) { color = c; }
68  void SetNetID(DWORD id) { netid = id; }
69  void SetSessionID(Text s) { session_id = s; }
70  void SetHost(bool h) { host = h; }
71 
72  void SetAuthLevel(int n) { auth_level = n; }
73  void SetAuthState(int n) { auth_state = n; }
74  void SetSalt(const char* s) { strcpy_s(salt, s);}
75 
76  void SetSquadron(const char* s) { squadron = s; }
77  void SetSignature(const char* s){ signature = s; }
78  void SetRank(int n) { rank = n; }
79  void SetFlightTime(int n) { flight_time = n;}
80  void SetMissions(int n) { missions = n; }
81  void SetKills(int n) { kills = n; }
82  void SetLosses(int n) { losses = n; }
83 
85 
86 protected:
91  DWORD netid;
93  bool host;
94 
95  // authentication:
98  char salt[33];
99 
100  // stats:
103  int rank;
105  int missions;
106  int kills;
107  int losses;
108 };
109 
110 // +-------------------------------------------------------------------+
111 
112 #endif NetUser_h