9
9
* Copyright (C) 1998 Brent Hendricks.
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.
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.
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.
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.
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
49
/* Table Information */
52
/* Pointer to room this table resides in */
53
struct _GGZRoom *room;
55
/* Server ID of table */
59
struct _GGZGameType *gametype;
61
/* Table description */
68
unsigned int num_seats;
71
struct _GGZSeat *seats;
73
/* Total spectator seats */
74
unsigned int num_spectator_seats;
76
/* Spectator seats - "type" is unused; player name is
77
NULL for empty seat. */
78
struct _GGZSeat *spectator_seats;
82
struct _GGZTable* _ggzcore_table_new(void);
84
void _ggzcore_table_init(struct _GGZTable *table,
85
struct _GGZGameType *gametype,
52
GGZTable* _ggzcore_table_new(void);
54
void _ggzcore_table_init(GGZTable *table,
55
const GGZGameType *gametype,
87
57
const unsigned int num_seats,
88
58
const GGZTableState state,
91
void _ggzcore_table_free(struct _GGZTable *table);
61
void _ggzcore_table_free(GGZTable *table);
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);
98
68
/** @brief Change a seat value.
101
71
* called by both front-end and back-end functions to do the
102
72
* actual work of changing the seat.
104
void _ggzcore_table_set_seat(struct _GGZTable *table, struct _GGZSeat *seat);
74
void _ggzcore_table_set_seat(GGZTable *table, GGZTableSeat *seat);
107
77
/** @brief Change a spectator seat value.
109
79
* This changes the seat status for any spectator seat at the table.
111
void _ggzcore_table_set_spectator_seat(struct _GGZTable *table,
112
struct _GGZSeat *seat);
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);
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);
81
void _ggzcore_table_set_spectator_seat(GGZTable *table,
84
/* These functions return pointers to the seat data directly within the
86
GGZTableSeat _ggzcore_table_get_nth_seat(const GGZTable *table,
88
GGZTableSeat _ggzcore_table_get_nth_spectator_seat(const GGZTable *table,
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);