Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetLobbyClient.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: NetLobbyClient.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  UDP-oriented network lobby client class
13 */
14 
15 
16 #ifndef NetLobbyClient_h
17 #define NetLobbyClient_h
18 
19 #include "NetLobby.h"
20 #include "NetClientConfig.h"
21 
22 // +-------------------------------------------------------------------+
23 
24 class NetLobbyClient : public NetLobby
25 {
26 public:
28  NetLobbyClient(const NetAddr& server_addr);
29  virtual ~NetLobbyClient();
30 
31  int operator == (const NetLobbyClient& c) const { return this == &c; }
32 
33  virtual void ExecFrame();
34  virtual bool Login(bool host=false);
35  virtual bool Logout();
36  virtual int GetLastError() const { return exit_code; }
37 
38  // actions:
39  virtual bool Ping();
40  virtual void GameStart();
41  virtual void GameStop();
42 
43  virtual void BanUser(NetUser* user);
44 
45  virtual void AddChat(NetUser* user, const char* msg, bool route=true);
46  virtual List<NetChatEntry>&
47  GetChat();
48 
49  NetAddr GetServerAddr() const { return addr; }
50  virtual bool IsHost() const { return host; }
51  virtual bool IsClient() const { return true; }
52 
53  virtual List<NetUser>& GetUsers();
55  virtual List<NetUnitEntry>& GetUnitMap();
56  virtual void MapUnit(int n, const char* user, bool lock=false);
57  virtual void SelectMission(DWORD id);
58  virtual Mission* GetSelectedMission();
59 
60  virtual List<ModInfo>& GetServerMods();
61 
62  // overrides for ping support:
63  virtual const Text& GetMachineInfo();
64  virtual int GetStatus() const;
65  virtual int NumUsers();
66  virtual bool HasHost();
67  virtual WORD GetGamePort();
68 
69 protected:
70  virtual void SendData(int type, Text msg);
71  virtual void DoServerInfo(NetPeer* peer, Text msg);
72  virtual void DoServerMods(NetPeer* peer, Text msg);
73  virtual void DoAuthUser(NetPeer* peer, Text msg);
74  virtual void DoChat(NetPeer* peer, Text msg);
75  virtual void DoUserList(NetPeer* peer, Text msg);
76  virtual void DoMissionList(NetPeer* peer, Text msg);
77  virtual void DoMissionSelect(NetPeer* peer, Text msg);
78  virtual void DoMissionData(NetPeer* peer, Text msg);
79  virtual void DoUnitList(NetPeer* peer, Text msg);
80  virtual void DoMapUnit(NetPeer* peer, Text msg);
81  virtual void DoGameStart(NetPeer* peer, Text msg);
82  virtual void DoExit(NetPeer* peer, Text msg);
83 
84  DWORD server_id;
86  bool host;
88  int exit_code;
89 
92 
93  bool temporary;
100 };
101 
102 // +-------------------------------------------------------------------+
103 
104 #endif NetLobbyClient_h