Merge branch 'master' of NalaGinrut@repo.or.cz:srv/git/NalaBridge
[NalaBridge.git] / src / Game.h
blob271cdc3f99724fbef9e338c118a0b8eeca47523c
1 /***************************************************************************
2 * Copyright (C) 2008 by NalaGinrut *
3 * suimualatsuki@163.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef GAME_H
21 #define GAME_H
23 /*!
24 \file Game.h
25 \brief ¹ØÓÚÿ¾ÖÓÎÏ·µÄËùÓÐÊý¾Ý½á¹¹
28 #include "Player.h"
29 #include "COO.h"
31 #define EndGame 4
32 #define Begin 1
34 #define Full 4
36 //----------------------------------------------------------------------------------
37 /*!
38 \struct GameProcess
39 \brief (ÐÐΪ½Ó¿Ú)ÓÎÏ·¹ý³Ì
41 //----------------------------------------------------------------------------------
42 typedef struct GameProcess
44 /*!½øÐнÐÅÆ
45 \n º¯ÊýÖ¸Õ룬ָÏòGameBid()*/
46 int (*bid) (void);
48 /*!½øÐÐÒ»ÂÖ³öÅÆ
49 \n º¯ÊýÖ¸Õ룬ָÏòGamePlay()*/
50 int (*play) (void);
52 /*!ˢбÈÈüÊý¾Ý£¬Ã¿ÂÖplayÖ®ºóÐèÒªrefreshÒ»´Î
53 \n º¯ÊýÖ¸Õ룬ָÏòGameRefresh()*/
54 int (*refresh) (void);
56 /*!ÅжϹý³ÌÊÇ·ñ½áÊø£¬°üÀ¨ÓÎÏ·¹ý³Ì ºÍ ½ÐÅƹý³Ì
57 \n º¯ÊýÖ¸Õ룬ָÏòNoEnd()*/
58 int (*noend) (void);
60 /*!¼ÓÈëplayerÖ¸ÏòµÄÍæ¼Ò£¬Èç¹ûÒÑÂú£¬Ôò·µ»Ø´íÎó
61 \n º¯ÊýÖ¸Õ룬ָÏòGameJoin()*/
62 int (*join)(void *,void *);
64 /*!¼ì²éÓÎÏ·ÖÐÊÇ·ñÓпÕȱÍæ¼Ò£¬Óоͷµ»ØFALSE£¬·ñÔò·µ»ØTRUE
65 \n º¯ÊýÖ¸Õ룬ָÏòGameIsFull()*/
66 int (*isfull)();
68 process;
70 //----------------------------------------------------------------------------------
71 /*!\struct GameClass
72 \brief Ä£ÄâÀ࣬һ¾ÖÓÎÏ·µÄÀàÐÍ
74 //------------------------------------------------------------------------------------
75 typedef struct GameClass
77 /*!½«ÅÆ*/
78 UINT8 trump;
79 /*!Íê½áͶƱ£¬ÈôËùÓÐplayer¶¼Í¶Æ±Íê½á£¬Ôò´Ë´Î»î¶¯½áÊø*/
80 UINT8 end_vote;
81 /*!½ÐÅÆ´ÎÐò*/
82 PlayerList bid_order[4];
83 /*!½ÐÅÆÁбí,δ±ØÓõõ½,Ä¿Ç°¿¼ÂÇÓÃÒ»¸öµ±Ç°Íæ¼ÒflagÀ´½øÐÐclock wiseµÄÑ­»·*/
84 PlayerList bid_list[4];
85 /*!³öÅÆ´ÎÐò,δ±ØÓõõ½,Ä¿Ç°¿¼ÂÇÓÃÒ»¸öµ±Ç°Íæ¼ÒflagÀ´½øÐÐclock wiseµÄÑ­»·*/
86 char *play_order;
87 /*!±±ÄÏ·ÖÊý×ܺÍ*/
88 UINT32 NS_score;
89 /*!¶«Î÷·ÖÊý×ܺÍ*/
90 UINT32 EW_score;
91 /*!µ±Ç°¸Ã³öÅƵÄÍæ¼Ò*/
92 struct Player *current;
94 /*!ÓÎÏ·¹ý³Ì*/
95 struct GameProcess run;
97 game,*gameptr;
99 /*!
100 \struct GlobalData
101 \brief ½«GameÖеĹ«ÓÃÊý¾Ý¿½±´µ½GlobleDataÖУ¬·½±ãºó¼Ìµ÷ÓÃ
103 typedef struct GlobalData
105 /*!½«ÅÆ*/
106 UINT8 trump;
107 /*!Íê½áͶƱ£¬ÈôËùÓÐplayer¶¼Í¶Æ±Íê½á£¬Ôò´Ë´Î»î¶¯½áÊø*/
108 UINT8 end_vote;
109 /*!½ÐÅÆ´ÎÐò*/
110 PlayerList bid_order[4];
111 /*!½ÐÅÆÁбí*/
112 PlayerList bid_list[4];
113 /*!³öÅÆ´ÎÐò*/
114 char *play_order;
115 /*!±±ÄÏ·ÖÊý×ܺÍ*/
116 UINT32 NS_score;
117 /*!¶«Î÷·ÖÊý×ܺÍ*/
118 UINT32 EW_score;
119 /*!ÓÎÏ·¼ÌÐø±êÖ¾*/
120 UINT8 no_quit;
121 /*!µ±Ç°¸Ã³öÅƵÄÍæ¼Ò*/
122 struct Player *current;
123 /*!µ±Ç°Íæ¼Ò±àºÅ*/
124 UINT8 cur_num;
126 global_data,gd,*gdp;
128 //¹¹Ô캯ÊýµÄÉùÃ÷£»
129 void GameClass(game *);
131 //Process½Ó¿ÚµÄº¯ÊýÉùÃ÷£»
132 int GameBid();
133 int GamePlay();
134 int GameRefresh();
135 int GameJoin(game *,player *);
136 int GameIsFull();
137 int NoEnd();
140 #endif // END OF GAME_H;