~ubuntu-branches/ubuntu/edgy/ggz-client-libs/edgy

« back to all changes in this revision

Viewing changes to ggzcore/gametype.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut, Josef Spillner, Peter Eisentraut
  • Date: 2006-09-09 13:37:14 UTC
  • mfrom: (2.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20060909133714-q49a9kvjfkc0wcc3
Tags: 0.0.13-3
[ Josef Spillner ]
* Change ggzcore-bin dependency from ggzmod to recommends from ggzcore
  (closes: #384671).

[ Peter Eisentraut ]
* Make package dependencies binNMU-safe through use of ${binary:Version}
  (closes: #386126)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * File: gametype.h
3
 
 * Author: Justin Zaun
 
3
 * Author: GGZ Development Team
4
4
 * Project: GGZ Core Client Lib
5
5
 * Date: 6/5/00
6
 
 * $Id: gametype.h,v 1.11 2002/11/03 19:37:36 jdorje Exp $
7
 
 *
8
 
 * This file contains functions for handling game types
9
 
 *
10
 
 * Copyright (C) 1998 Brent Hendricks.
11
 
 *
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.
16
 
 *
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 $
 
7
 *
 
8
 * This file contains functions for handling game types.
 
9
 *
 
10
 * Copyright (C) 1998-2005 GGZ Development Team.
 
11
 *
 
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.
 
16
 * 
 
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.
21
 
 *
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.
 
21
 * 
 
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
25
25
 */
26
26
 
27
27
#include <ggz_common.h>
28
28
 
 
29
#include <ggzcore.h>
 
30
 
29
31
#ifndef __GAMETYPE_H_
30
32
#define __GAMETYPE_H_
31
33
 
32
34
 
33
 
/* Structure describing specific game type */
34
 
struct _GGZGameType {
35
 
        
36
 
        /* Name of the game */
37
 
        char *name;
38
 
 
39
 
        /* Version */
40
 
        char *version;
41
 
 
42
 
        /* Protocol engine */
43
 
        char *prot_engine;
44
 
 
45
 
        /* Protocol version */
46
 
        char *prot_version;
47
 
 
48
 
        /* Game description */
49
 
        char *desc;
50
 
 
51
 
        /* Author */
52
 
        char *author;
53
 
 
54
 
        /* Homepage for game */
55
 
        char *url;
56
 
 
57
 
        /* Bitmask of alowable numbers of players */
58
 
        GGZNumberList player_allow_list;
59
 
 
60
 
        /* Bitmask of alowable numbers of bots */
61
 
        GGZNumberList bot_allow_list;
62
 
 
63
 
        /* Whether spectators are allowed or not */
64
 
        unsigned int spectators_allowed;
65
 
        
66
 
        /* ID of this game on the server */
67
 
        unsigned int id;
68
 
};
69
 
 
70
 
 
71
35
/* Create a new gametype object */
72
 
struct _GGZGameType* _ggzcore_gametype_new(void);
 
36
GGZGameType* _ggzcore_gametype_new(void);
73
37
 
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,
77
41
                            const char* name, 
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,
84
49
                            const char* desc,
85
50
                            const char* author, 
86
51
                            const char *url);
87
52
 
88
 
void _ggzcore_gametype_free(struct _GGZGameType *type);
89
 
 
90
 
unsigned int _ggzcore_gametype_get_id(struct _GGZGameType *type);
91
 
 
92
 
const char * _ggzcore_gametype_get_name(struct _GGZGameType *type);
93
 
 
94
 
const char * _ggzcore_gametype_get_version(struct _GGZGameType *type);
95
 
 
96
 
const char * _ggzcore_gametype_get_prot_engine(struct _GGZGameType *type);
97
 
 
98
 
const char * _ggzcore_gametype_get_prot_version(struct _GGZGameType *type);
99
 
 
100
 
const char * _ggzcore_gametype_get_author(struct _GGZGameType *type);
101
 
 
102
 
const char * _ggzcore_gametype_get_url(struct _GGZGameType *type);
103
 
 
104
 
const char * _ggzcore_gametype_get_desc(struct _GGZGameType *type);
105
 
 
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);
110
 
 
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);
114
 
 
 
53
void _ggzcore_gametype_add_namedbot(GGZGameType *gametype,
 
54
                            const char *botname,
 
55
                            const char *botclass);
 
56
 
 
57
void _ggzcore_gametype_free(GGZGameType *type);
115
58
 
116
59
/* Utility functions used by _ggzcore_list */
117
60
int   _ggzcore_gametype_compare(void* p, void* q);