1 /***************************************************************************
2 * Copyright (C) 2008 by NalaGinrut *
3 * suimualatsuki@163.com *
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. *
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. *
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 ***************************************************************************/
23 \brief ‘°ü‘º¬Game‘¿Ø‘ÖÆ‘µÄ‘Ëù‘ÓБº¯‘Êý
35 //‘¿Ø‘ÖÆ‘º¯‘Êý‘Ì呵đʵ‘ÏÖ
39 \brief ‘È«‘¾Ö‘¿Ø‘ÖÆ‘±ä‘Á¿
41 extern global_data GameData;
45 * @return ERROR number
51 C_Class GameClass g=NewClass(GameClass,g);
52 C_Class PlayerClass west=NewClass(PlayerClass,west);
53 C_Class PlayerClass north=NewClass(PlayerClass,north);
54 C_Class PlayerClass east=NewClass(PlayerClass,east);
56 C_Class PlayerClass south=NewClass(PlayerClass,south);
59 GameData.current=west;//FIXME:‘×¢‘Òâ‘¿¼‘ÂÇ‘È瑺Α½«‘¿Ø‘ÖƑȨ‘½»‘¸ø‘µ±‘Ç°‘Í摼ґ£¬‘ÊÇ‘±¾‘³Ì‘ÐòCOO‘ʵ‘ÏÖ‘µÄ‘¹Ø‘¼ü‘Ö®‘Ëù‘ÔÚ‘£»
60 //FIXME:‘Ä¿‘Ç°‘»¹‘ÓБ´ý‘Íê‘ÉÆ‘£»*/
62 assert(g.run.bid!=NULL);
64 printf("g.run.noend()=%d\n",g.run.noend());
66 while (g.run.noend()==TRUE)
70 GameData.end_vote++;//‘ʵ‘¼Ê‘ÉÏGameData‘ÔÚ‘±à‘³Ì‘ÖБ²»‘¿É‘¼û‘£¬‘Òª‘ͨ‘¹ý‘·½‘·¨‘À´‘Éè‘ÖÑËü‘£¬‘´Ë‘´¦‘Ö»‘ÊǑʾ‘Àý‘£»
72 //FIXME:‘´Ë‘´¦‘Ó¦‘Õâ‘Ñù:
80 * \fn int GameRestart()
81 * @return ERROR number
83 \n ‘ÓΑϷ‘ÖؑБÆô‘¶¯‘£¬‘Б¿ª‘Ò»‘¾Ö‘ÓΑϷ
90 * @return ERROR number
92 \n ‘½á‘Êø‘ÓΑϷ‘£¬‘²¢‘ÍË‘³ö
98 * \fn int GameScoreDisplay()
99 * @return ERROR number
100 \brief ‘Ïԑʾ‘ÓΑϷ‘·Ö‘Êý
101 \n ‘Ïԑʾ‘µ½‘Ä¿‘Ç°‘Ϊ‘Ö¹‘ÓΑϷ‘½ø‘¶È‘¸÷‘¸ö‘Í摼ґµÄ‘·Ö‘Êý
103 int GameScoreDisplay()
108 * @return ERROR number
109 \brief ‘ÅБ¶Ï‘Ò»‘¾Ö‘ÓΑϷ‘ÊÇ‘·ñ‘½á‘Êø
110 \n ‘ͨ‘¹ý‘ÅБ¶Ï‘Í摼ґµÄ ‘Íꑽá‘Ͷ‘Ʊ ‘À´‘¾ö‘¶¨‘ÊÇ‘·ñ‘½á‘Êø‘Ò»‘¾Ö‘ÓΑϷ
111 \n ‘ͨ‘³£‘È瑹û‘½á‘Êø‘µÄ‘»°‘Òâ‘ζ‘×Å‘£º(1)‘ÅÆ‘ÒÑ‘¾‘³ö‘Íê‘¡¢(2)‘½Ð‘ÅÆ‘Íꑳɑ¡¢(3)‘Ëù‘ÓБÍ摼ґͨ‘¹ý‘ʤ‘Àû‘Ðû‘ÑÔ
115 return IsEqu(GameData.no_quit,NO);
119 * \fn int GameInit(game *g)
121 * @return ERROR number
122 \brief ‘³õ‘ʼ‘»¯‘ÓΑϷ‘Êý‘¾Ý
123 \n ‘½«‘ÓΑϷ‘Àà‘¡¢‘Í摼ґÀà‘µÄ‘Êý‘¾Ý‘³õ‘ʼ‘»¯
125 int GameInit(game *g)
130 SetData(g->trump ,South);
131 SetData(g->end_vote ,Begin);
132 //SetData(g->bid_order,Init);
133 //SetData(g->bid_list,Init);
135 //‘´Ë‘´¦‘Ðè‘Òª‘¸Ä‘½ø‘£¬‘¹Ø‘ÓÚ‘Êý‘¾Ý‘Àà‘ÐÍ‘µÄ‘×Ô‘¶¯‘ʶ‘±ð‘¼°‘³õ‘ʼ‘»¯‘£»
137 SetData(g->play_order ,Init);
138 SetData(g->NS_score ,Init);
139 SetData(g->EW_score ,Init);
141 SetFunc(g->run.bid ,GameBid);
142 SetFunc(g->run.play ,GamePlay);
143 SetFunc(g->run.refresh ,GameRefresh);
144 SetFunc(g->run.noend ,NoEnd);
145 SetFunc(g->run.isfull ,GameIsFull);
146 SetFunc(g->run.join ,GameJoin);