1 /* $Header: /home/jcb/MahJong/newmj/RCS/controller.h,v 12.1 2014/01/02 22:26:03 jcb Exp $
2  * controller.h
3  * Contains type definitions etc used by the controller program.
4  */
5 /****************** COPYRIGHT STATEMENT **********************
6  * This file is Copyright (c) 2000 by J. C. Bradfield.       *
7  * Distribution and use is governed by the LICENCE file that *
8  * accompanies this file.                                    *
9  * The moral rights of the author are asserted.              *
10  *                                                           *
11  ***************** DISCLAIMER OF WARRANTY ********************
12  * This code is not warranted fit for any purpose. See the   *
13  * LICENCE file for further information.                     *
14  *                                                           *
15  *************************************************************/
16 
17 #ifndef CONTROLLER_H_INCLUDED
18 #define CONTROLLER_H_INCLUDED 1
19 
20 #include "tiles.h"
21 #include "player.h"
22 #include "protocol.h"
23 #include "game.h"
24 
25 /* extra data in the game */
26 typedef struct {
27   PlayerP caller; /* used to keep a copy of the winning player just
28 		     before mah-jong */
29   /* array of pointers to CMsgs issued in this hand. This is
30      used when reconnecting. The array is 512, since the maximum
31      number of messages that can (relevantly) be issued in a hand
32      is around 4 per tile, but that's highly unlikely ever to be
33      reached -- but it can be, so say 1024. This ought to be dynamic... */
34   int histcount;
35   CMsgMsg *history[1024];
36   /* this is used to keep the state at the start of the last
37      hand, so we can print out the hand just completed */
38   /* needs one Game Message and as many options as there may be */
39   int prehistcount;
40   CMsgMsg *prehistory[1+GOEnd];
41   int completed_rounds; /* number of completed rounds. This ought to be
42 			   added to the Game structure and message, but
43 			   that's too much work, and we only really need it
44 			   internally. */
45 } GameExtras;
46 #define gextras(g) ((GameExtras *)((g)->userdata))
47 
48 #endif /* CONTROLLER_H_INCLUDED */
49