Ejemplo n.º 1
0
//是否听牌
bool CGameLogic::IsTingCard( const BYTE cbCardIndex[MAX_INDEX], const tagWeaveItem WeaveItem[], BYTE cbWeaveCount )
{
	//复制数据
	BYTE cbCardIndexTemp[MAX_INDEX];
	CopyMemory( cbCardIndexTemp,cbCardIndex,sizeof(cbCardIndexTemp) );

	CChiHuRight chr;
	for( BYTE i = 0; i < MAX_INDEX-7; i++ )
	{
		BYTE cbCurrentCard = SwitchToCardData( i );
		if( WIK_CHI_HU == AnalyseChiHuCard( cbCardIndexTemp,WeaveItem,cbWeaveCount,cbCurrentCard,chr ) )
			return true;
	}
	return false;
}
Ejemplo n.º 2
0
//听牌分析
BYTE CGameLogic::AnalyseTingCard(BYTE cbCardIndex[MAX_INDEX], tagWeaveItem WeaveItem[], BYTE cbItemCount, DWORD dwChiHuRight)
{
	//变量定义
	tagChiHuResult ChiHuResult;
	ZeroMemory(&ChiHuResult,sizeof(ChiHuResult));

	//构造扑克
	BYTE cbCardIndexTemp[MAX_INDEX];
	CopyMemory(cbCardIndexTemp,cbCardIndex,sizeof(cbCardIndexTemp));

	//听牌分析
	for (BYTE i=0;i<MAX_INDEX;i++)
	{
		//空牌过滤
		if (cbCardIndexTemp[i]==0)
			continue;

		//听牌处理
		cbCardIndexTemp[i]--;

		//听牌判断
		for (BYTE j=0;j<MAX_INDEX;j++)
		{
			//胡牌分析
			BYTE cbCurrentCard=SwitchToCardData(j);
			BYTE cbHuCardKind=AnalyseChiHuCard(cbCardIndexTemp,WeaveItem,cbItemCount,cbCurrentCard,dwChiHuRight,ChiHuResult);

			//结果判断
			if (cbHuCardKind!=CHK_NULL) 
				return WIK_LISTEN;
		}

		//还原处理
		cbCardIndexTemp[i]++;
	}

	return WIK_NULL;
}