6
* Desc: GGZ game module functions, GGZ side
7
* $Id: ggzmod-ggz.h,v 1.1 2002/10/21 04:26:59 jdorje Exp $
9
* This file contains the GGZ-only interface for the ggzmod library. This
10
* library facilitates the communication between the GGZ server (ggz)
11
* and game servers. This file provides a unified interface that can be
14
* Copyright (C) 2002 GGZ Development Team.
16
* This program is free software; you can redistribute it and/or modify
17
* it under the terms of the GNU General Public License as published by
18
* the Free Software Foundation; either version 2 of the License, or
19
* (at your option) any later version.
21
* This program is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU General Public License for more details.
26
* You should have received a copy of the GNU General Public License
27
* along with this program; if not, write to the Free Software
28
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
32
#ifndef __GGZMOD_GGZ_H__
33
#define __GGZMOD_GGZ_H__
36
/* Sit down (stop spectatin; join a seat) */
37
GGZMOD_TRANSACTION_SIT,
39
/* Stand up (leave your seat; become a spectator) */
40
GGZMOD_TRANSACTION_STAND,
43
GGZMOD_TRANSACTION_BOOT,
45
/* Replace a bot/reserved seat with an open one */
46
GGZMOD_TRANSACTION_OPEN,
48
/* Put a bot into an open seat */
49
GGZMOD_TRANSACTION_BOT
52
typedef void (*GGZModTransactionHandler) (GGZMod * mod, GGZModTransaction t,
55
void ggzmod_set_transaction_handler(GGZMod * ggzmod, GGZModTransaction t,
56
GGZModTransactionHandler func);
58
/** @brief Set the module executable, pwd, and arguments
60
* GGZmod must execute and launch the game to start a table; this
61
* function allows ggz to specify how this should be done.
62
* @note This should not be called by the table, only ggz.
63
* @param ggzmod The GGZmod object.
64
* @param pwd The working directory for the game, or NULL.
65
* @param args The arguments for the program, as needed by exec.
66
* @note The pwd directory must already exist.
68
void ggzmod_set_module(GGZMod * ggzmod, const char *pwd, char **args);
71
/** @brief Set the fd of the game server connection
72
* @param ggzmod The GGZMod object.
73
* @return The server connection fd
75
void ggzmod_set_server_fd(GGZMod * ggzmod, int fd);
77
/** @brief Set data about which seat at which this ggzmod is sitting.
79
* The GGZ client can use this function to set data about this client.
80
* @param ggzmod The GGZMod object.
81
* @param is_spectator TRUE iff the player is a spectator.
82
* @param seat_num The seat or spectator seat number.
83
* @return 0 on success, negative on error.
85
int ggzmod_set_player(GGZMod *ggzmod,
87
int is_spectator, int seat_num);
89
/** @brief Set seat data.
91
* The GGZ client can use this function to set data about
93
* @param seat The new seat structure (which includes seat number).
94
* @return 0 on success, negative on failure.
96
int ggzmod_set_seat(GGZMod *ggzmod, GGZSeat * seat);
98
/** @brief Set spectator data.
100
* The GGZ client can use this function to set data about a spectator seat.
101
* @param seat The new spectator seat data.
102
* @return 0 on success, negative on failure.
104
int ggzmod_set_spectator_seat(GGZMod * ggzmod, GGZSpectatorSeat * seat);
106
#endif /* __GGZMOD_GGZ_H__ */