/[LeafOK_CVS]/pvpgn-1.7.4/src/bnetd/game.h
ViewVC logotype

Contents of /pvpgn-1.7.4/src/bnetd/game.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Jun 24 09:19:06 2006 UTC (19 years, 8 months ago) by sysadm
Branch: MAIN
CVS Tags: pvpgn_1-7-4-0_MIL, HEAD
Changes since 1.1: +1 -1 lines
Content type: text/x-chdr
Auto check void game, fix bug

1 /*
2 * Copyright (C) 1998 Mark Baysinger (mbaysing@ucsd.edu)
3 * Copyright (C) 1998,1999,2000,2001 Ross Combs (rocombs@cs.nmsu.edu)
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 #ifndef INCLUDED_GAME_TYPES
20 #define INCLUDED_GAME_TYPES
21
22 #ifdef GAME_INTERNAL_ACCESS
23
24 #ifdef JUST_NEED_TYPES
25 # ifdef TIME_WITH_SYS_TIME
26 # include <sys/time.h>
27 # include <time.h>
28 # else
29 # ifdef HAVE_SYS_TIME_H
30 # include <sys/time.h>
31 # else
32 # include <time.h>
33 # endif
34 # endif
35 # include "account.h"
36 # include "connection.h"
37 # include "common/tag.h"
38 # include "common/elist.h"
39 #else
40 # define JUST_NEED_TYPES
41 # ifdef TIME_WITH_SYS_TIME
42 # include <sys/time.h>
43 # include <time.h>
44 # else
45 # ifdef HAVE_SYS_TIME_H
46 # include <sys/time.h>
47 # else
48 # include <time.h>
49 # endif
50 # endif
51 # include "account.h"
52 # include "connection.h"
53 # include "common/tag.h"
54 # include "common/elist.h"
55 # undef JUST_NEED_TYPES
56 #endif
57
58 #endif
59
60 typedef enum
61 {
62 game_type_none,
63 game_type_all,
64 game_type_topvbot,
65 game_type_melee,
66 game_type_ffa,
67 game_type_oneonone,
68 game_type_ctf,
69 game_type_greed,
70 game_type_slaughter,
71 game_type_sdeath,
72 game_type_ladder,
73 game_type_ironman,
74 game_type_mapset,
75 game_type_teammelee,
76 game_type_teamffa,
77 game_type_teamctf,
78 game_type_pgl,
79 game_type_diablo,
80 game_type_diablo2open,
81 game_type_diablo2closed,
82 game_type_anongame
83 } t_game_type;
84
85 typedef enum
86 {
87 game_status_started,
88 game_status_full,
89 game_status_open,
90 game_status_done
91 } t_game_status;
92
93 typedef enum
94 {
95 game_result_none,
96 game_result_win,
97 game_result_loss,
98 game_result_draw,
99 game_result_disconnect,
100 game_result_observer,
101 game_result_playing
102 } t_game_result;
103
104 typedef enum
105 {
106 game_option_none,
107 game_option_melee_normal,
108 game_option_ffa_normal,
109 game_option_oneonone_normal,
110 game_option_ctf_normal,
111 game_option_greed_10000,
112 game_option_greed_7500,
113 game_option_greed_5000,
114 game_option_greed_2500,
115 game_option_slaughter_60,
116 game_option_slaughter_45,
117 game_option_slaughter_30,
118 game_option_slaughter_15,
119 game_option_sdeath_normal,
120 game_option_ladder_countasloss,
121 game_option_ladder_nopenalty,
122 game_option_mapset_normal,
123 game_option_teammelee_4,
124 game_option_teammelee_3,
125 game_option_teammelee_2,
126 game_option_teamffa_4,
127 game_option_teamffa_3,
128 game_option_teamffa_2,
129 game_option_teamctf_4,
130 game_option_teamctf_3,
131 game_option_teamctf_2,
132 game_option_topvbot_7,
133 game_option_topvbot_6,
134 game_option_topvbot_5,
135 game_option_topvbot_4,
136 game_option_topvbot_3,
137 game_option_topvbot_2,
138 game_option_topvbot_1
139 } t_game_option;
140
141 typedef enum
142 {
143 game_maptype_none,
144 game_maptype_selfmade,
145 game_maptype_blizzard,
146 game_maptype_ladder,
147 game_maptype_pgl
148 } t_game_maptype;
149
150 typedef enum
151 {
152 game_tileset_none,
153 game_tileset_badlands,
154 game_tileset_space,
155 game_tileset_installation,
156 game_tileset_ashworld,
157 game_tileset_jungle,
158 game_tileset_desert,
159 game_tileset_ice,
160 game_tileset_twilight
161 } t_game_tileset;
162
163 typedef enum
164 {
165 game_speed_none,
166 game_speed_slowest,
167 game_speed_slower,
168 game_speed_slow,
169 game_speed_normal,
170 game_speed_fast,
171 game_speed_faster,
172 game_speed_fastest
173 } t_game_speed;
174
175 typedef enum
176 {
177 game_difficulty_none,
178 game_difficulty_normal,
179 game_difficulty_nightmare,
180 game_difficulty_hell,
181 game_difficulty_hardcore_normal,
182 game_difficulty_hardcore_nightmare,
183 game_difficulty_hardcore_hell
184 } t_game_difficulty;
185
186 typedef enum {
187 game_flag_none,
188 game_flag_private
189 } t_game_flag;
190
191 typedef struct game
192 #ifdef GAME_INTERNAL_ACCESS
193 {
194 char const * name;
195 char const * pass;
196 char const * info;
197 t_game_type type;
198 unsigned int realm;
199 char const * realmname;
200 t_clienttag clienttag; /* type of client (STAR, SEXP, etc) */
201 unsigned int addr; /* host IP */
202 unsigned short port; /* host port */
203 int startver;
204 unsigned long version;
205 t_game_status status;
206 unsigned int ref; /* current number of players */
207 unsigned int count; /* max number of players */
208 unsigned int id;
209 char const * mapname;
210 t_game_option option;
211 t_game_maptype maptype;
212 t_game_tileset tileset;
213 t_game_speed speed;
214 unsigned int mapsize_x;
215 unsigned int mapsize_y;
216 unsigned int maxplayers;
217
218 t_connection * owner;
219 t_connection * * connections;
220 t_account * * players;
221 t_game_result * results;
222 t_game_result * * reported_results;
223 char const * * report_heads;
224 char const * * report_bodies;
225
226 time_t create_time;
227 time_t start_time;
228 time_t lastaccess_time;
229 int bad; /* if 1, then the results will be ignored */
230 t_game_difficulty difficulty;
231 char const * description;
232 t_game_flag flag;
233 t_elist glist_link;
234 }
235 #endif
236 t_game;
237
238 typedef int (*t_glist_func)(t_game *, void *);
239
240 #endif
241
242
243 #ifndef JUST_NEED_TYPES
244 #ifndef INCLUDED_GAME_PROTOS
245 #define INCLUDED_GAME_PROTOS
246
247 #define MAX_GAME_EMPTY_TIME 30
248 #define STARTVER_UNKNOWN 0
249 #define STARTVER_GW1 1
250 #define STARTVER_GW3 3
251 #define STARTVER_GW4 4
252 #define STARTVER_REALM1 104
253
254 #define JUST_NEED_TYPES
255 #ifdef TIME_WITH_SYS_TIME
256 # include <sys/time.h>
257 # include <time.h>
258 #else
259 # ifdef HAVE_SYS_TIME_H
260 # include <sys/time.h>
261 # else
262 # include <time.h>
263 # endif
264 #endif
265 #include "account.h"
266 #include "connection.h"
267 #include "common/list.h"
268 #include "common/tag.h"
269 #undef JUST_NEED_TYPES
270
271 extern char const * game_type_get_str(t_game_type type) ;
272 extern char const * game_status_get_str(t_game_status status) ;
273 extern char const * game_result_get_str(t_game_result result) ;
274 extern char const * game_option_get_str(t_game_option option) ;
275 extern char const * game_maptype_get_str(t_game_maptype maptype) ;
276 extern char const * game_tileset_get_str(t_game_tileset tileset) ;
277 extern char const * game_speed_get_str(t_game_speed speed) ;
278 extern char const * game_difficulty_get_str(t_game_difficulty difficulty) ;
279 extern t_game * game_create(char const * name, char const * pass, char const * info, t_game_type type, int startver, t_clienttag clienttag,unsigned long gameversion) ;
280 extern unsigned int game_get_id(t_game const * game);
281 extern char const * game_get_name(t_game const * game);
282 extern t_game_type game_get_type(t_game const * game);
283 extern t_game_maptype game_get_maptype(t_game const * game);
284 extern int game_set_maptype(t_game * game, t_game_maptype maptype);
285 extern t_game_tileset game_get_tileset(t_game const * game);
286 extern int game_set_tileset(t_game * game, t_game_tileset tileset);
287 extern t_game_speed game_get_speed(t_game const * game);
288 extern int game_set_speed(t_game * game, t_game_speed speed);
289 extern unsigned int game_get_mapsize_x(t_game const * game);
290 extern int game_set_mapsize_x(t_game * game, unsigned int x);
291 extern unsigned int game_get_mapsize_y(t_game const * game);
292 extern int game_set_mapsize_y(t_game * game, unsigned int y);
293 extern unsigned int game_get_maxplayers(t_game const * game);
294 extern int game_set_maxplayers(t_game * game, unsigned int maxplayers);
295 extern unsigned int game_get_difficulty(t_game const * game);
296 extern int game_set_difficulty(t_game * game, unsigned int difficulty);
297 extern char const * game_get_description(t_game const * game);
298 extern int game_set_description(t_game * game, char const * description);
299 extern char const * game_get_pass(t_game const * game);
300 extern char const * game_get_info(t_game const * game);
301 extern unsigned long game_get_version(t_game const * game);
302 extern int game_get_startver(t_game const * game);
303 extern unsigned int game_get_ref(t_game const * game);
304 extern unsigned int game_get_count(t_game const * game);
305 extern void game_set_status(t_game * game, t_game_status status);
306 extern t_game_status game_get_status(t_game const * game);
307 extern unsigned int game_get_addr(t_game const * game);
308 extern unsigned short game_get_port(t_game const * game);
309 extern unsigned int game_get_latency(t_game const * game);
310 extern t_connection * game_get_player_conn(t_game const * game, unsigned int i);
311 extern t_clienttag game_get_clienttag(t_game const * game);
312 extern int game_add_player(t_game * game, char const * pass, int startver, t_connection * c);
313 extern int game_del_player(t_game * game, t_connection * c);
314 extern int game_set_report(t_game * game, t_account * account, char const * head, char const * body);
315 extern int game_set_reported_results(t_game * game, t_account * account, t_game_result * results);
316 extern int game_set_self_report(t_game * game, t_account * account, t_game_result result);
317 extern t_game_result * game_get_reported_results(t_game * game, t_account * account);
318 extern char const * game_get_mapname(t_game const * game);
319 extern int game_set_mapname(t_game * game, char const * mapname);
320 extern t_connection * game_get_owner(t_game const * game);
321 extern time_t game_get_create_time(t_game const * game);
322 extern time_t game_get_start_time(t_game const * game);
323 extern int game_set_option(t_game * game, t_game_option option);
324 extern t_game_option game_get_option(t_game const * game);
325 extern int gamelist_create(void);
326 extern int gamelist_destroy(void);
327 extern int gamelist_get_length(void);
328 extern t_game * gamelist_find_game(char const * name, t_game_type type);
329 extern t_game * gamelist_find_game_byid(unsigned int id);
330 extern void gamelist_traverse(t_glist_func cb, void *data);
331 extern int gamelist_total_games(void);
332 extern int game_set_realm(t_game * game, unsigned int realm);
333 extern unsigned int game_get_realm(t_game const * game);
334 extern char const * game_get_realmname(t_game const * game);
335 extern int game_set_realmname(t_game * game, char const * realmname);
336 extern void gamelist_check_voidgame(void);
337 extern void game_set_flag(t_game * game, t_game_flag flag);
338 extern t_game_flag game_get_flag(t_game const * game);
339 extern int game_get_count_by_clienttag(t_clienttag ct);
340 extern int game_is_ladder(t_game *game);
341
342 #endif
343 #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1