Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetClientConfig.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
6  FILE: NetClientConfig.h
7  AUTHOR: John DiCamillo
8 
9 */
10 
11 #ifndef NetClientConfig_h
12 #define NetClientConfig_h
13 
14 #include "Types.h"
15 #include "Game.h"
16 #include "Text.h"
17 #include "List.h"
18 
19 #include "NetAddr.h"
20 
21 // +--------------------------------------------------------------------+
22 
23 class NetLobbyClient;
24 class NetServerInfo;
25 
26 // +--------------------------------------------------------------------+
27 
29 {
30 public:
33 
34  void AddServer(const char* name,
35  const char* addr,
36  WORD port,
37  const char* password,
38  bool save=false);
39  void DelServer(int index);
40 
41  List<NetServerInfo>& GetServerList() { return servers; }
43  void Download();
44  void Load();
45  void Save();
46 
47  void SetServerIndex(int n) { server_index = n; }
48  int GetServerIndex() const { return server_index; }
49  void SetHostRequest(bool n) { host_request = n; }
50  bool GetHostRequest() const { return host_request; }
52 
53  void CreateConnection();
55  bool Login();
56  bool Logout();
57  void DropConnection();
58 
59  static void Initialize();
60  static void Close();
61  static NetClientConfig* GetInstance() { return instance; }
62 
63 private:
64  List<NetServerInfo> servers;
65  int server_index;
66  bool host_request;
67 
68  NetLobbyClient* conn;
69 
70  static NetClientConfig* instance;
71 };
72 
73 #endif NetClientConfig_h