Beispiel #1
0
void ShortHand() { // uses global shnd[5] cards && assigns indices of 'AKQJTs'
  unsigned int fsut = rkst[shnd[0]][1], sutd = 1, ndxc;
  SortCards();
  for(ndxc = 0; ndxc < 5; ndxc++) {
    if(fsut != rkst[shnd[ndxc]][1]) { sutd = 0; }
    shnd[ndxc] = rkst[shnd[ndxc]][0];
  }
  if(sutd) { shnd[5] = 0; }
  else     { shnd[5] = 1; }
}
Beispiel #2
0
CARDTYPE CMethod::SendCards(vector<SCARD>& player,vector<SENDCARDS>& sendCard)//出牌
	{
	SENDCARDS tempSendCard;
	if (!m_send.empty())
	{
	      m_send.clear();
	}
	 for (int i=0;i<player.size();i++)
	 {
	  if (player[i].isUp==true)
	  {
	  tempSendCard.cx=player[i].cx;
	  tempSendCard.cy=player[i].cy;
	  tempSendCard.ID=player[i].ID;
	    m_send.push_back(tempSendCard);
	  }
	 }
      //判断牌型
	 if (!m_send.empty())
	 {
	 //符合出牌规则,删除要出的牌
	 CARDTYPE  tempEnmu=JudgeCardsType(m_send);
	  if(tempEnmu!=ERRORCARDS)
		  {
		  if (((m_maxCard>m_sendArray.max)&&(tempEnmu==m_sendArray.type&&m_send.size()==m_sendArray.cardNum))||(m_noSendNum==2))
		  {
		  vector <SCARD>::iterator tempIter;
		  vector <SCARD>::iterator tempIter1;
		  for (tempIter =player.begin();tempIter!=player.end();)
			  {
			  if (tempIter->isUp)
				  {
				  tempIter=player.erase(tempIter);

				  for (tempIter1=tempIter;tempIter1!=player.end();tempIter1++)
					  tempIter1->coord_x-=20;
				  }else
					  tempIter++;
			  }
		  SortCards(player);//对牌进行排序

		  for (vector<SENDCARDS>::iterator tempIter=sendCard.begin();tempIter!=sendCard.end();)
			  {
			  if (tempIter->ID==PLAYER_B)
				  {
				  tempIter=sendCard.erase(tempIter);
				  }else
					  tempIter++;
			  }
		  SENDCARDS imageTemp;
		  for (int i=0;i<m_send.size();i++)
			  {
			  imageTemp.coord_x=220.0f+i*20.0f;
			  imageTemp.coord_y=300.0f;
			  imageTemp.cx=m_send[i].cx;
			  imageTemp.cy=m_send[i].cy;
			  imageTemp.ID=PLAYER_B;
			  sendCard.push_back(imageTemp);
			  }

		  return  JudgeCardsType(m_send);
			  }
		  }
		  
	 }
	 
	return ERRORCARDS;
	}