Esempio n. 1
0
CardCounter::CardCounter(const PlayerState &p)
{
    for(Card *c : p.hand           ) AddCard(c);
    for(Card *c : p.deck           ) AddCard(c);
    for(Card *c : p.discard        ) AddCard(c);
    for(CardPlayInfo c : p.playArea) AddCard(c.card);
}
Esempio n. 2
0
void Pile::AddCard(wxDC& dc, Card* card)
{
    AddCard(card);
    int x, y;
    GetTopCardPos(x, y);
    card->Draw(dc, x, y);
}
Esempio n. 3
0
NS_IMETHODIMP nsAbView::OnItemAdded(nsISupports *parentDir, nsISupports *item)
{
  nsresult rv;
  nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(parentDir,&rv);
  NS_ENSURE_SUCCESS(rv,rv);

  if (directory.get() == mDirectory.get()) {
    nsCOMPtr <nsIAbCard> addedCard = do_QueryInterface(item);
    if (addedCard) {
      // Malloc these from an arena
      AbCard *abcard = (AbCard *) PR_Calloc(1, sizeof(struct AbCard));
      if (!abcard) 
        return NS_ERROR_OUT_OF_MEMORY;

      abcard->card = addedCard;
      NS_IF_ADDREF(abcard->card);
    
      rv = GenerateCollationKeysForCard(mSortColumn.get(), abcard);
      NS_ENSURE_SUCCESS(rv,rv);

      PRInt32 index;
      rv = AddCard(abcard, false /* select card */, &index);
      NS_ENSURE_SUCCESS(rv,rv);
    }
  }
  return rv;
}
Esempio n. 4
0
void CPoker::InitTaxasPoker()
{
	SetupCardCount(52);
	for ( int i = 1 ; i <= 52 ; ++i )
	{
		AddCard(i) ;
	}
	RestAllPoker() ;
}
Esempio n. 5
0
void CardDisplay::init(MTGGameZone * zone)
{
    resetObjects();
    if (!zone) return;
    start_item = 0;
    for (int i = 0; i < zone->nb_cards; i++)
    {
        AddCard(zone->cards[i]);
    }
    if (mObjects.size()) mObjects[0]->Entering();
}
Esempio n. 6
0
void CPoker::InitPaiJiu()
{
	SetupCardCount(32);
	// red 
	unsigned char nRed[] = { 12,2,8,4,10,7,6,9,5} ;
	unsigned char nBlack[] = {10,6,4,7,8,11} ;
	
	CCard stcard(2) ;
	// red ;
	unsigned char ncount = sizeof(nRed) / (sizeof(unsigned char));
	for (int i = 0 ; i < ncount ; ++i )
	{
		stcard.SetCard(CCard::eCard_Heart,nRed[i]);
		AddCard(&stcard);
		stcard.SetCard(CCard::eCard_Diamond,nRed[i]);
		AddCard(&stcard);
	}

	// black 
	ncount = sizeof(nBlack) / (sizeof(unsigned char));
	for (int i = 0 ; i < ncount ; ++i )
	{
		stcard.SetCard(CCard::eCard_Club,nBlack[i]);
		AddCard(&stcard);
		stcard.SetCard(CCard::eCard_Sword,nBlack[i]);
		AddCard(&stcard);
	}

	// add hei tao A , and  3 ;
	stcard.SetCard(CCard::eCard_Sword,1);
	AddCard(&stcard);
	stcard.SetCard(CCard::eCard_Sword,3);
	AddCard(&stcard);
}
Esempio n. 7
0
addressCard whichcardtake(){
	int i = 1;
	int biggest = 0;
	addressCard T = First(card_on_off);
	addressCard B = NULL;
	while(T != NULL && i<=7){
		ClearListCard(&temp_card);
		addressCard C = First(Hand(player_who_play));
		while(C != NULL){
			AddCard(&temp_card,Card(C));
			C = Next(C);
		}
		if(trees(temp_card,Card(T))>2){
			addressCard O = First(card_on_off);
			while(O != NULL){
				AddCard(&temp_card,Card(O));
				if((SameCard(Card(O),Card(T))==1)){
					break;
				}
				O = Next(O);
			}	
		}
		if(B == NULL){
			B = T;
			biggest = trees(temp_card,Card(T));
		}else{
			if(biggest<trees(temp_card,Card(T))){
				B = T;
				biggest = trees(temp_card,Card(T));
			}
		}
		T = Next(T);
		i++;
	}
	if(biggest<3){
		B = NULL;
	}
	return B;
}
Esempio n. 8
0
int AddStandardCards(CardLib api, int nJokers)
{
   DEBUG_FUNC_NAME;

   int nSuit;
   int nValue;
   for(nSuit=SUIT_START; nSuit<=SUIT_END; nSuit++) {
      for(nValue = VALUE_START; nValue<=VALUE_END; nValue++) {
         Card c;
         CreateCard(&c, nSuit, nValue);
         AddCard(api, c);
      }
   }

   int n;
   for(n=0; n<nJokers; n++) {
      Card c;
      CreateCard(&c, JOKER, -1);
      AddCard(api, c);
   }

   return CARDLIB_OK;
}
Esempio n. 9
0
void CPoker::InitBaccarat()
{
	int nCard = 8 ;
	SetupCardCount(52 * nCard );
	while ( nCard-- )
	{
		for ( int i = 1 ; i <= 52 ; ++i )
		{
			AddCard(i) ;
		}
	}

	RestAllPoker() ;
}
Esempio n. 10
0
PyObject * quisk_sound_errors(PyObject * self, PyObject * args)
{  // return a list of strings with card names and error counts
	PyObject * pylist;

	if (!PyArg_ParseTuple (args, ""))
		return NULL;
	pylist = PyList_New(0);
	AddCard(&Capture,	pylist, "Capture radio samples");
	AddCard(&MicCapture,	pylist, "Capture microphone samples");
	AddCard(&DigitalInput,	pylist, "Capture digital Tx samples");
	AddCard(&Playback,	pylist, "Play radio sound");
	AddCard(&MicPlayback,	pylist, "Play microphone sound");
	AddCard(&DigitalOutput,	pylist, "Play digital mode sound");
	AddCard(&RawSamplePlayback, pylist, "Play raw samples");
	return pylist;
}
Esempio n. 11
0
void Player::Sort()
{
	Card temp;
	const int numcards = GetNumCards();
	Card* CardArr = new Card[GetNumCards()];
	for (int i = GetNumCards() - 1; GetNumCards(); i--)
	{
		Discard(i, CardArr[i]);
	}
	for (int i = 0; i < numcards; i++)
	{
		for (int j = 1; j < numcards; j++)
		{
			if (CardArr[j].GetSuit() < CardArr[j - 1].GetSuit())
			{
				temp = CardArr[j]; CardArr[j] = CardArr[j - 1];
				CardArr[j - 1] = temp;
			}
		}
	}
	for (int i = 0; i < numcards; i++)
	{
		for (int j = 1; j < numcards; j++)
		{
			if (CardArr[j].GetFace() < CardArr[j - 1].GetFace())
			{
				if (CardArr[j].GetSuit() == CardArr[j - 1].GetSuit())
				{
					temp = CardArr[j]; CardArr[j] = CardArr[j - 1];
					CardArr[j - 1] = temp;
				}
			}
		}
	}
	for (int i = 0; i < numcards; i++)
	{
		AddCard(CardArr[i]);
	}
	delete[] CardArr;
}
Esempio n. 12
0
// resets deck
void CDeck::resetDeck(bool bFull)
{
	CCard* pCard;
	POINT pt;

	pt.x = 100;
	pt.y = 100;
	EmptyHand();

	if (bFull) {
		// initialize the 52 card deck
		for(CCard::Suit suit = CCard::Hearts; suit <= CCard::Spades; suit++)
		{
			for(CCard::Rank rank = CCard::Ace; rank <= CCard::King; rank++)
			{
				pCard = new CCard();
				pCard->setCard(rank, suit);
				pCard->setFaceUp(false);
				pCard->setFileName(L"");
				pCard->setLocation(pt);
				pCard->setSpriteLength(0);
				pCard->setSpriteWidth(0);
				pCard->setFrontTexture(NULL);
				pCard->setBackTexture(NULL);

				AddCard(pCard);
			}
		}
	}

	if (m_pD3D10Device != NULL) {
		InitSprite(m_pD3D10Device, bFull);
	}

	return;
}
Esempio n. 13
0
int F846305(TRUSERID *handle,int iRequest,ST_PACK *rPack,int *pRetCode,char *szMsg)
{
    int i=0;
    int ret=0;
    char sysdate[9]="";
    char systime[7]="";
    char sMsg[256]="";

    CAccTrans *pAccTrans=CAccTrans::getInstance();
    TRANS& trans=pAccTrans->trans;
    ret=pAccTrans->checkCfgUpdate();
    if(ret)
        return ret;
    pAccTrans->clear();
    ret=pAccTrans->initOperDtl(rPack->semp);
    if(ret)
        return ret;
    GetCpackDataString(rPack,pAccTrans->cpackdata);
    pAccTrans->trans.transcode=TC_CARDRENEW;
    ret=pAccTrans->addOperDtl();
    if(ret)
        return ret;
    ST_CPACK aPack;
    ST_PACK *outPack = &(aPack.pack);

    ResetNormalCPack(&aPack,0,1);


    SetCol(handle,0);


    //检查操作员

    //检查客户
    T_t_customer tCustomer;
    T_t_card  tOldCard;

    memset(&tCustomer,0,sizeof(tCustomer));
    memset(&tOldCard,0,sizeof(tOldCard));

    int cardno=rPack->lvol0;
    ret=check(cardno,tCustomer,tOldCard);
    if(ret)
        return ret;
    //注销原卡
    ret=DB_t_card_read_lock_by_cur_and_cardno(tOldCard.cardno,&tOldCard);
    if(ret)
    {
        writelog(LOG_ERR,"lost_cardno[%d]",tOldCard.cardno);
        if(DB_NOTFOUND==ret)
            return E_CARDNO_NOT_EXIST;
        else
            return E_DB_CARD_R;
    }
    tOldCard.status[0]=STATUS_LOGOUT;			//注销
    des2src(tOldCard.closedate,sysdate);		//注销日期
    ret=DB_t_card_update_lock_by_cur(&tOldCard);
    if(ret)
    {
        writelog(LOG_ERR,"lost_cardno[%d]",tOldCard.cardno);
        if(DB_NOTFOUND==ret)
            return E_CARDNO_NOT_EXIST;
        else
            return E_DB_CARD_R;
    }
    //使用卡片
    T_t_card  tCard;
    memset(&tCard,0,sizeof(tCard));

    des2src(tCard.cardphyid,rPack->sstation0);
    des2src(tCard.showcardno,rPack->sorder0);
    des2src(tCard.expiredate,tOldCard.expiredate);
    tCard.cardtype=tOldCard.cardtype;
    tCard.feetype=tOldCard.feetype;
    des2src(tCard.cardpwd,tOldCard.cardpwd);

    ret=chkShowCardNo(trans.opercode,tCard.cardtype,tCard.showcardno);
    if(ret)
    {
        return ret;
    }
    char cardpwd[33]="";
    char key[17]="";

    //get_init_passwd_by_man_id(tCustomer.idno,cardpwd);
    strcpy(key,STATIC_SEED_KEY);
    EncodePwd(key,cardpwd,tOldCard.cardpwd, 1);

    ret=AddCard(tCustomer,tCard);
    if(ret)
        return ret;
    //添加卡片使用明细
    T_t_carddtl tCarddtl;

    memset(&tCarddtl,0,sizeof(tCarddtl));
    /////////////////////////////////rPack2TableStuct////////////////////////
    des2src(tCarddtl.accdate,trans.accdate);
    tCarddtl.termid=trans.termid;
    tCarddtl.termseqno=trans.termseqno;
    tCarddtl.cardtype=tCard.cardtype;
    des2src(tCarddtl.showcardno,tCard.showcardno);
    des2src(tCarddtl.cardphyid,tCard.cardphyid);
    tCarddtl.cardusetype[0]=CARDUSETYPE_OPENCARD;
    des2src(tCarddtl.opercode,trans.opercode);
    ret=DB_t_carddtl_add(&tCarddtl);
    if(ret)
    {
        if(DB_REPEAT==ret)
            return E_DB_CARDDTL_E;
        else
            return E_DB_CARDDTL_I;
    }

    //添加换卡记录
    T_t_cardinstead tCardinstead;

    memset(&tCardinstead,0,sizeof(tCardinstead));

    des2src(tCardinstead.accdate,trans.accdate);
    tCardinstead.termid=trans.termid;
    tCardinstead.termseqno=trans.termseqno;
    tCardinstead.oldcardno=tOldCard.cardno;
    des2src(tCardinstead.oldcardphyid,tOldCard.cardphyid);
    tCardinstead.cardno=tCard.cardno;
    des2src(tCardinstead.cardphyid,tCard.cardphyid);
    ret=DB_t_cardinstead_add(&tCardinstead);
    if(ret)
    {
        if(DB_REPEAT==ret)
            return E_DB_CARDINSTEAD_E;
        else
            return E_DB_CARDINSTEAD_I;
    }
    //插入卡位图表
    T_t_cardbitmap tCardBitmap;

    tCardBitmap.cardno=tCard.cardno;
    tCardBitmap.baseno=0;
    memset(tCardBitmap.bitmap,'0',sizeof(tCardBitmap.bitmap));
    tCardBitmap.bitmap[0]='1';

    ret=DB_t_cardbitmap_add(&tCardBitmap);
    if(ret)
    {
        if(DB_REPEAT==ret)
            return E_DB_CARDBITMAP_E;
        else
            return E_DB_CARDBITMAP_I;
    }

    T_t_account tCardaccount;
    memset(&tCardaccount,0,sizeof(tCardaccount));
    ret=DB_t_account_read_lock_by_c1_and_cardno_and_purseno(tOldCard.cardno,PURSE_NO_ONE,&tCardaccount);
    if(ret)
    {
        if(DB_NOTFOUND==ret)
            return E_DB_ACCOUNT_N;
        else
            return E_DB_ACCOUNT_R;

    }
    tCardaccount.cardno=tCard.cardno;
    //考虑补助
    tCardaccount.availbal= tCardaccount.availbal+ tCardaccount.subsidybal;
    tCardaccount.subsidybal=0;
    tCardaccount.lastcardcnt=1;
    tCardaccount.lastcardbal=tCardaccount.availbal;
    getsysdate(tCardaccount.lasttransdate);
    ret=DB_t_account_update_lock_by_c1(&tCardaccount);
    if(ret)
    {
        return E_DB_ACCOUNT_U;
    }
    ///////////////////////////////
    pAccTrans->trans.usecardflag=1;
    pAccTrans->trans.custid=tCustomer.custid;
    pAccTrans->trans.feetype=tCard.feetype;
    //////////////////////////////
    pAccTrans->trans.fundtype=rPack->lvol9;
    pAccTrans->trans.inputamt=rPack->damt0;

    des2src(pAccTrans->cti.cardaccno,tCardaccount.accno);
    pAccTrans->cti.cardno=tCardaccount.cardno;
    pAccTrans->cti.purseno=tCardaccount.purseno;
    pAccTrans->cti.cardtype=tCard.cardtype;
    pAccTrans->cti.cardbefbal=0;
    pAccTrans->cti.cardaftbal=0;
    pAccTrans->cti.cardcnt=1;
    pAccTrans->cti.calaftbalflag=0;

    ret=pAccTrans->doAccTrans();
    if(ret)
        return ret;
    T_t_cardtransdtl cardtransdtl;
    memset(&cardtransdtl,0,sizeof(cardtransdtl));

    strcpy(cardtransdtl.transdate,trans.transdate);
    strcpy(cardtransdtl.transtime,trans.transtime);
    strcpy(cardtransdtl.accdate,trans.accdate);
    strcpy(cardtransdtl.acctime,trans.acctime);
    cardtransdtl.termid=trans.termid;
    cardtransdtl.termseqno=trans.termseqno;
    cardtransdtl.transcode=trans.transcode;
    des2src(cardtransdtl.opercode,trans.opercode);
    cardtransdtl.status[0]=DTLSTATUS_SUCCESS;
    cardtransdtl.errcode=0;
    ret=DB_t_cardtransdtl_add(&cardtransdtl);
    if(ret)
    {
        if(DB_REPEAT==ret)
            return E_DB_CARDTRANSDTL_E;
        else
            return E_DB_CARDTRANSDTL_I;
    }
    SetCol(handle,F_LVOL1,F_LSAFE_LEVEL2,F_LVOL5,
           F_SALL_NAME,F_SPAGER,F_SCERT_NO,
           F_SEMAIL2,F_SMARKET_CODE,F_SDATE0,
           F_LVOL0,F_STX_PWD,F_LVOL8,
           F_SORDER0,F_SDATE3,F_SEMP,
           F_LWITHDRAW_FLAG,F_LSERIAL1,F_VSMESS,0);
    outPack->lvol1=tCustomer.custid;
    outPack->lsafe_level2=tCustomer.custtype;
    outPack->lvol5=tCard.feetype;
    des2src(outPack->sall_name,tCustomer.custname);
    des2src(outPack->spager,tCustomer.stuempno);
    des2src(outPack->scert_no,tCustomer.deptcode);
    des2src(outPack->semail2,tCustomer.idno);
    des2src(outPack->smarket_code,tCustomer.sex);
    des2src(outPack->sdate0,tCard.expiredate);
    outPack->lvol0=tCard.cardno;
    des2src(outPack->stx_pwd,cardpwd);
    outPack->lvol8=0;
    des2src(outPack->sorder0,tCard.showcardno);
    des2src(outPack->sdate3,trans.accdate);
    des2src(outPack->semp,trans.opercode);
    outPack->lwithdraw_flag=trans.termid;
    outPack->lserial1=trans.termseqno;
    strcpy(outPack->vsmess,pAccTrans->remark.c_str());
    PutRow(handle,outPack,pRetCode,szMsg);
    return 0;
}
Esempio n. 14
0
void CPoker::AddCard(CCard* pcard)   // invoke when init
{
	AddCard(pcard->GetCardCompositeNum()) ;
}
Esempio n. 15
0
CardCounter::CardCounter(const Vector<Card*> &cardList)
{
    for(Card *c : cardList) AddCard(c);
}
Esempio n. 16
0
void hhPokerHand::operator=(hhPokerHand &other) {
	Clear();
	for (int ix=0; ix<other.cards.Num(); ix++) {
		AddCard(other.cards[ix]);
	}
}
Esempio n. 17
0
NS_IMETHODIMP nsAbView::OnItemPropertyChanged(nsISupports *item, const char *property, const PRUnichar *oldValue, const PRUnichar *newValue)
{
  nsresult rv;

  nsCOMPtr <nsIAbCard> card = do_QueryInterface(item);
  if (!card)
    return NS_OK;

  PRInt32 index = FindIndexForCard(card);
  if (index == -1)
    return NS_OK;

  AbCard *oldCard = (AbCard*) (mCards.ElementAt(index));

  // Malloc these from an arena
  AbCard *newCard = (AbCard *) PR_Calloc(1, sizeof(struct AbCard));
  if (!newCard)
    return NS_ERROR_OUT_OF_MEMORY;

  newCard->card = card;
  NS_IF_ADDREF(newCard->card);
    
  rv = GenerateCollationKeysForCard(mSortColumn.get(), newCard);
  NS_ENSURE_SUCCESS(rv,rv);

  bool cardWasSelected = false;

  if (mTreeSelection) {
    rv = mTreeSelection->IsSelected(index, &cardWasSelected);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  
  if (!CompareCollationKeys(newCard->primaryCollationKey,newCard->primaryCollationKeyLen,oldCard->primaryCollationKey,oldCard->primaryCollationKeyLen)
    && CompareCollationKeys(newCard->secondaryCollationKey,newCard->secondaryCollationKeyLen,oldCard->secondaryCollationKey,oldCard->secondaryCollationKeyLen)) {
    // No need to remove and add, since the collation keys haven't changed.
    // Since they haven't changed, the card will sort to the same place.
    // We just need to clean up what we allocated.
    NS_IF_RELEASE(newCard->card);
    if (newCard->primaryCollationKey)
      nsMemory::Free(newCard->primaryCollationKey);
    if (newCard->secondaryCollationKey)
      nsMemory::Free(newCard->secondaryCollationKey);
    PR_FREEIF(newCard);

    // Still need to invalidate, as the other columns may have changed.
    rv = InvalidateTree(index);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  else {
    mSuppressSelectionChange = true;
    mSuppressCountChange = true;

    // Remove the old card.
    rv = RemoveCardAt(index);
    NS_ASSERTION(NS_SUCCEEDED(rv), "remove card failed\n");

    // Add the card we created, and select it (to restore selection) if it was selected.
    rv = AddCard(newCard, cardWasSelected /* select card */, &index);
    NS_ASSERTION(NS_SUCCEEDED(rv), "add card failed\n");

    mSuppressSelectionChange = false;
    mSuppressCountChange = false;

    // Ensure restored selection is visible
    if (cardWasSelected && mTree) 
      mTree->EnsureRowIsVisible(index);
  }

  // Although the selection hasn't changed, the card that is selected may need
  // to be displayed differently, therefore pretend that the selection has
  // changed to force that update.
  if (cardWasSelected)
    SelectionChanged();

  return NS_OK;
}