1 /* game_4wins.h - NeonServ v5.4
2 * Copyright (C) 2011-2012 Philipp Kreil (pk910)
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "../../timeq.h"
21 #define FOURWINS_STATE_WAITING 1
22 #define FOURWINS_STATE_RUNNING 2
24 #define FOURWINS_MATRIX_WIDTH 7
25 #define FOURWINS_MATRIX_HEIGHT 6
27 #define FOURWINS_MAX_STONES (FOURWINS_MATRIX_WIDTH * FOURWINS_MATRIX_HEIGHT)
33 extern struct fourwins_game *fourwins_active_games;
35 struct fourwins_guest {
36 struct ChanUser *chanuser;
37 struct fourwins_guest *next;
40 struct fourwins_game {
41 struct ChanUser *player[2];
43 struct fourwins_guest *guests;
44 struct ClientSocket *textbot;
47 unsigned int field:2; /* 0,1,2 */
48 } matrix[FOURWINS_MATRIX_WIDTH][FOURWINS_MATRIX_HEIGHT];
50 struct timeq_entry *timer;
51 struct fourwins_game *next;
54 int fourwins_next_free_y(struct fourwins_game *game, int x);
55 int fourwins_check_win(struct fourwins_game *game, int x, int y);
56 void fourwins_show_matrix(struct fourwins_game *game);
57 TIMEQ_CALLBACK(fourwins_timeout);
58 void fourwins_free_game(struct fourwins_game *game);
59 void fourwins_event_part(struct ChanUser *chanuser);
60 void fourwins_event_freechan(struct ChanNode *chan);