source: golgotha/src/golg/net/server.hh

Last change on this file was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.4 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef G1_SERVER_HH
10#define G1_SERVER_HH
11
12
13#include "network/net_addr.hh"
14#include "network/net_sock.hh"
15#include "g1_limits.hh"
16#include "time/time.hh"
17
18class g1_server_class
19{
20  friend class g1_server_start_window;
21
22  struct client
23  {
24    i4_net_address *addr;
25    i4_time_class last_data;
26    i4_str *username;
27    i4_net_socket *send;
28   
29    void cleanup();
30  };
31
32  client clients[G1_MAX_PLAYERS];   // network address of each client
33
34  i4_net_socket *udp_port;
35  enum {
36    WAITING_FOR_PLAYERS,
37    RUNNING,
38    QUITING
39  } state;
40   
41  i4_net_protocol *protocol;
42  void send_player_joined(int client_num);
43  void process_client_packet(w8 *packet, int packet_length, int client_num);
44  i4_str *map_name;
45  i4_bool list_changed;
46
47public:
48  g1_server_class(int use_port, i4_net_protocol *protocol);
49  void start_game();
50  void poll(); 
51  ~g1_server_class();
52};
53
54extern class g1_server_class *g1_server;
55
56#endif
Note: See TracBrowser for help on using the repository browser.