3
* Author: GGZ Development Team
4
4
* Project: GGZ Core Client Lib
6
* $Id: gametype.h,v 1.11 2002/11/03 19:37:36 jdorje Exp $
8
* This file contains functions for handling game types
10
* Copyright (C) 1998 Brent Hendricks.
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 2 of the License, or
15
* (at your option) any later version.
17
* This program is distributed in the hope that it will be useful,
6
* $Id: gametype.h 7889 2006-03-07 09:57:32Z josef $
8
* This file contains functions for handling game types.
10
* Copyright (C) 1998-2005 GGZ Development Team.
12
* This library is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU Lesser General Public
14
* License as published by the Free Software Foundation; either
15
* version 2.1 of the License, or (at your option) any later version.
17
* This library is distributed in the hope that it will be useful,
18
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* Lesser General Public License for more details.
22
* You should have received a copy of the GNU Lesser General Public
23
* License along with this library; if not, write to the Free Software
24
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
27
#include <ggz_common.h>
29
31
#ifndef __GAMETYPE_H_
30
32
#define __GAMETYPE_H_
33
/* Structure describing specific game type */
36
/* Name of the game */
45
/* Protocol version */
48
/* Game description */
54
/* Homepage for game */
57
/* Bitmask of alowable numbers of players */
58
GGZNumberList player_allow_list;
60
/* Bitmask of alowable numbers of bots */
61
GGZNumberList bot_allow_list;
63
/* Whether spectators are allowed or not */
64
unsigned int spectators_allowed;
66
/* ID of this game on the server */
71
35
/* Create a new gametype object */
72
struct _GGZGameType* _ggzcore_gametype_new(void);
36
GGZGameType* _ggzcore_gametype_new(void);
74
38
/* Initialize a gametype with the given properties */
75
void _ggzcore_gametype_init(struct _GGZGameType *gametype,
39
void _ggzcore_gametype_init(GGZGameType *gametype,
76
40
const unsigned int id,
78
42
const char* version,
81
45
const GGZNumberList player_allow_list,
82
46
const GGZNumberList bot_allow_list,
83
47
unsigned int spectators_allowed,
48
unsigned int peers_allowed,
85
50
const char* author,
88
void _ggzcore_gametype_free(struct _GGZGameType *type);
90
unsigned int _ggzcore_gametype_get_id(struct _GGZGameType *type);
92
const char * _ggzcore_gametype_get_name(struct _GGZGameType *type);
94
const char * _ggzcore_gametype_get_version(struct _GGZGameType *type);
96
const char * _ggzcore_gametype_get_prot_engine(struct _GGZGameType *type);
98
const char * _ggzcore_gametype_get_prot_version(struct _GGZGameType *type);
100
const char * _ggzcore_gametype_get_author(struct _GGZGameType *type);
102
const char * _ggzcore_gametype_get_url(struct _GGZGameType *type);
104
const char * _ggzcore_gametype_get_desc(struct _GGZGameType *type);
106
/* Return the maximum number of allowed players/bots */
107
unsigned int _ggzcore_gametype_get_max_players(struct _GGZGameType *type);
108
unsigned int _ggzcore_gametype_get_max_bots(struct _GGZGameType *type);
109
unsigned int _ggzcore_gametype_get_spectators_allowed(struct _GGZGameType *type);
111
/* Verify that a paticular number of players/bots is valid */
112
unsigned int _ggzcore_gametype_num_players_is_valid(struct _GGZGameType *type, unsigned int num);
113
unsigned int _ggzcore_gametype_num_bots_is_valid(struct _GGZGameType *type, unsigned int num);
53
void _ggzcore_gametype_add_namedbot(GGZGameType *gametype,
55
const char *botclass);
57
void _ggzcore_gametype_free(GGZGameType *type);
116
59
/* Utility functions used by _ggzcore_list */
117
60
int _ggzcore_gametype_compare(void* p, void* q);