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

« back to all changes in this revision

Viewing changes to ggzcore/table.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:
8
8
 *
9
9
 * Copyright (C) 1998 Brent Hendricks.
10
10
 *
11
 
 * This program is free software; you can redistribute it and/or modify
12
 
 * it under the terms of the GNU General Public License as published by
13
 
 * the Free Software Foundation; either version 2 of the License, or
14
 
 * (at your option) any later version.
15
 
 *
16
 
 * This program is distributed in the hope that it will be useful,
 
11
 * This library is free software; you can redistribute it and/or
 
12
 * modify it under the terms of the GNU Lesser General Public
 
13
 * License as published by the Free Software Foundation; either
 
14
 * version 2.1 of the License, or (at your option) any later version.
 
15
 * 
 
16
 * This library is distributed in the hope that it will be useful,
17
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
 * GNU General Public License for more details.
20
 
 *
21
 
 * You should have received a copy of the GNU General Public License
22
 
 * along with this program; if not, write to the Free Software
23
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
 * Lesser General Public License for more details.
 
20
 * 
 
21
 * You should have received a copy of the GNU Lesser General Public
 
22
 * License along with this library; if not, write to the Free Software
 
23
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24
24
 */
25
25
 
26
26
 
32
32
#include "gametype.h"
33
33
#include "ggzcore.h"
34
34
 
35
 
struct _GGZSeat {
 
35
 
 
36
typedef struct GGZTableSeat GGZTableSeat;
 
37
 
 
38
struct GGZTableSeat {
36
39
        /* Seat index */
37
40
        int index;
38
41
 
46
49
};
47
50
 
48
51
 
49
 
/* Table Information */
50
 
struct _GGZTable {
51
 
 
52
 
        /* Pointer to room this table resides in */
53
 
        struct _GGZRoom *room;
54
 
 
55
 
        /* Server ID of table */
56
 
        int id;
57
 
 
58
 
        /* Game Type */
59
 
        struct _GGZGameType *gametype;
60
 
 
61
 
        /* Table description */
62
 
        const char * desc;        
63
 
 
64
 
        /* Table state */
65
 
        GGZTableState state;
66
 
 
67
 
        /* Total seats */
68
 
        unsigned int num_seats;
69
 
 
70
 
        /* Seats */
71
 
        struct _GGZSeat *seats;
72
 
 
73
 
        /* Total spectator seats */
74
 
        unsigned int num_spectator_seats;
75
 
 
76
 
        /* Spectator seats - "type" is unused; player name is
77
 
           NULL for empty seat. */
78
 
        struct _GGZSeat *spectator_seats;
79
 
};
80
 
 
81
 
 
82
 
struct _GGZTable* _ggzcore_table_new(void);
83
 
 
84
 
void _ggzcore_table_init(struct _GGZTable *table, 
85
 
                         struct _GGZGameType *gametype,
 
52
GGZTable* _ggzcore_table_new(void);
 
53
 
 
54
void _ggzcore_table_init(GGZTable *table, 
 
55
                         const GGZGameType *gametype,
86
56
                         const char *desc,
87
57
                         const unsigned int num_seats,
88
58
                         const GGZTableState state,
89
59
                         const int id);
90
60
 
91
 
void _ggzcore_table_free(struct _GGZTable *table);
 
61
void _ggzcore_table_free(GGZTable *table);
92
62
 
93
 
void _ggzcore_table_set_room(struct _GGZTable *table, struct _GGZRoom *room);
94
 
void _ggzcore_table_set_id(struct _GGZTable *table, const int id);
95
 
void _ggzcore_table_set_state(struct _GGZTable *table, const GGZTableState state);
96
 
void _ggzcore_table_set_desc(struct _GGZTable *table, const char *desc);
 
63
void _ggzcore_table_set_room(GGZTable *table, GGZRoom *room);
 
64
void _ggzcore_table_set_id(GGZTable *table, const int id);
 
65
void _ggzcore_table_set_state(GGZTable *table, const GGZTableState state);
 
66
void _ggzcore_table_set_desc(GGZTable *table, const char *desc);
97
67
 
98
68
/** @brief Change a seat value.
99
69
 *
101
71
 *  called by both front-end and back-end functions to do the
102
72
 *  actual work of changing the seat.
103
73
 */
104
 
void _ggzcore_table_set_seat(struct _GGZTable *table, struct _GGZSeat *seat);
 
74
void _ggzcore_table_set_seat(GGZTable *table, GGZTableSeat *seat);
105
75
 
106
76
 
107
77
/** @brief Change a spectator seat value.
108
78
 *
109
79
 *  This changes the seat status for any spectator seat at the table.
110
80
 */
111
 
void _ggzcore_table_set_spectator_seat(struct _GGZTable *table,
112
 
                                       struct _GGZSeat *seat);
113
 
 
114
 
struct _GGZRoom*      _ggzcore_table_get_room(struct _GGZTable *table);
115
 
int                   _ggzcore_table_get_id(struct _GGZTable *table);
116
 
struct _GGZGameType*  _ggzcore_table_get_type(struct _GGZTable *table);
117
 
const char * _ggzcore_table_get_desc(struct _GGZTable *table);
118
 
GGZTableState         _ggzcore_table_get_state(struct _GGZTable *table);
119
 
int _ggzcore_table_get_num_seats(GGZTable *table);
120
 
int _ggzcore_table_get_num_spectator_seats(GGZTable *table);
121
 
int                   _ggzcore_table_get_seat_count(struct _GGZTable *table, GGZSeatType type);
122
 
 
123
 
struct _GGZSeat* _ggzcore_table_get_nth_seat(GGZTable *table,
124
 
                                             const unsigned int num);
125
 
struct _GGZSeat* _ggzcore_table_get_nth_spectator_seat(GGZTable *table,
126
 
                                                       const unsigned int num);
127
 
const char * _ggzcore_table_get_nth_player_name(struct _GGZTable *table,
128
 
                                                const unsigned int num);
129
 
GGZSeatType _ggzcore_table_get_nth_player_type(struct _GGZTable *table, const unsigned int num);
130
 
const char *_ggzcore_table_get_nth_spectator_name(GGZTable *table,
131
 
                                                  const unsigned int num);
132
 
 
133
 
 
 
81
void _ggzcore_table_set_spectator_seat(GGZTable *table,
 
82
                                       GGZTableSeat *seat);
 
83
 
 
84
/* These functions return pointers to the seat data directly within the
 
85
 * table. */
 
86
GGZTableSeat _ggzcore_table_get_nth_seat(const GGZTable *table,
 
87
                                         unsigned int num);
 
88
GGZTableSeat _ggzcore_table_get_nth_spectator_seat(const GGZTable *table,
 
89
                                                   unsigned int num);
134
90
/* Utility functions used by _ggzcore_list */
135
 
int   _ggzcore_table_compare(void* p, void* q);
 
91
int _ggzcore_table_compare(const void* p, const void* q);
136
92
void* _ggzcore_table_create(void* p);
137
93
void  _ggzcore_table_destroy(void* p);
138
94