本文整理汇总了C++中CCard类的典型用法代码示例。如果您正苦于以下问题:C++ CCard类的具体用法?C++ CCard怎么用?C++ CCard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Disconnect
void CReader::Disconnect(tDisconnectMode disconnectMode)
{
m_oPKCS15.Clear(NULL);
if (m_poCard != NULL)
{
// Strange behaviour with Ctrl-C:
// It's possible that this function is called multiple times. Normally,
// this doesn't hurt except that after a Ctrl-C, m_poCard->Disconnect()
// throws us out of this function WITHOUT an exception! So the m_poCard
// is not deleted() and set to NULL allthough the next call to this function
// it contains rubbisch => CRASH.
// So we set m_poCard = NULL in advance, and only if an exception is thrown
// we assign it the old value.
CCard *poTemp = m_poCard;
m_poCard = NULL;
try {
poTemp->Disconnect(disconnectMode);
MWLOG(LEV_INFO, MOD_CAL, L" Disconnected from card in reader %ls",
m_wsReader.c_str());
delete poTemp;
}
catch(...) {
m_poCard = poTemp;
}
}
}
示例2: it
void CTable::distributeBoard()
{
if (!board_) return;
CPlayer *player;
CRingIterator it(ring_);
CCard *pCard;
// all-in players must be evaluated too
int state = PLAYER_STATE_PLAYING|PLAYER_STATE_ALLIN;
if (it.start(state))
{
do {
player = it.current()->getPlayer();
// if player has been all-in for longer
// than a complete hand, he doesn't have cards
if (player->hasHand())
{
pCard = board_->getCard();
while (pCard != NULL)
{
player->getHand()->addCard(pCard);
pCard = pCard->getNext();
}
}
} while (it.next(state));
}
}
示例3: GetContentsOnCurrentCard
bool CPart::SetTextContents( const std::string& inString )
{
CPartContents* contents = GetContentsOnCurrentCard();
if( contents )
contents->SetText( inString );
else
{
CCard * currCard = GetStack()->GetCurrentCard();
bool isBgPart = dynamic_cast<CBackground*>(mOwner) != NULL;
bool bgPartWithNonSharedText = (isBgPart && !GetSharedText());
contents = new CPartContents( bgPartWithNonSharedText ? currCard : mOwner );
contents->SetID( mID );
contents->SetText( inString );
contents->SetIsOnBackground( isBgPart );
if( bgPartWithNonSharedText ) // We're on the background layer, not on the card? But we don't have shared text? Add the contents to the current *card*!
{
currCard->AddPartContents( contents );
}
else // Otherwise, we're on the card, or on the background with shared text, add the contents to that.
{
mOwner->AddPartContents( contents );
}
}
return true;
}
示例4: while
ObjectID CDocument::GetUniqueIDForCard()
{
bool notUnique = true;
while( notUnique )
{
notUnique = false;
for( auto currStack = mStacks.begin(); currStack != mStacks.end(); currStack ++ )
{
size_t numCards = (*currStack)->GetNumCards();
for( size_t x = 0; x < numCards; x++ )
{
CCard * currCard = (*currStack)->GetCard(x);
if( currCard->GetID() == mCardIDSeed )
{
notUnique = true;
mCardIDSeed++;
break;
}
}
}
}
return mCardIDSeed;
}
示例5: GetStack
CPartContents* CPart::GetContentsOnCurrentCard()
{
CPartContents* contents = NULL;
CStack * currStack = GetStack();
if( !currStack )
return NULL;
CCard * currCard = currStack->GetCurrentCard();
if( !currCard )
return NULL;
bool isBgPart = dynamic_cast<CBackground*>(mOwner) != NULL;
bool bgPartWithNonSharedText = (isBgPart && !GetSharedText());
if( isBgPart && !GetSharedText() ) // We're on the background layer, not on the card, and don't have shared text?
{
contents = currCard->GetPartContentsByID( GetID(), isBgPart );
}
else
{
contents = mOwner->GetPartContentsByID( GetID(), isBgPart );
}
if( !contents )
{
contents = new CPartContents( currCard );
contents->SetID( mID );
contents->SetIsOnBackground( isBgPart );
if( bgPartWithNonSharedText )
currCard->AddPartContents( contents );
else
mOwner->AddPartContents( contents );
}
return contents;
}
示例6: CardPlayed
void CBot::CardPlayed(const CCard &c)
{
int n = c.GetNum() - 1;
if (c.IsJoker()) {
n += 13;
}
m_rgiRemainingCard[n]--;
}
示例7: CanChow
bool CDeck::CanChow(int const pIdx)
{
if(DumpPile->Empty())
return false;
CCard thrown = DumpPile->Pop();
DumpPile->Push(thrown); //just checking so push again
int Rank = thrown.Rank();
int Suit = thrown.Suit();
int a = PlayerHand[pIdx]->FindCard(Rank + 1, Suit);
int b = PlayerHand[pIdx]->FindCard(Rank + 2, Suit);
int c = PlayerHand[pIdx]->FindCard(Rank - 1, Suit);
int d = PlayerHand[pIdx]->FindCard(Rank - 2, Suit);
int e[3] = {-1, -1, -1}; //cards with same rank
e[0] = PlayerHand[pIdx]->FindMoreSameRank(0, Rank, Suit);
if(e[0] != -1) {
e[1] = PlayerHand[pIdx]->FindMoreSameRank(e[0] + 1, Rank, Suit);
if(e[1] != -1)
e[2] = PlayerHand[pIdx]->FindMoreSameRank(e[1] + 1, Rank, Suit);
}
if(a != -1 && b != -1) {
PlayerHand[pIdx]->SelectCard(a);
PlayerHand[pIdx]->SelectCard(b);
return true;
}
if(a != -1 && c != -1) {
PlayerHand[pIdx]->SelectCard(a);
PlayerHand[pIdx]->SelectCard(c);
return true;
}
if(c != -1 && d != -1) {
PlayerHand[pIdx]->SelectCard(c);
PlayerHand[pIdx]->SelectCard(d);
return true;
}
if(e[0] != -1 && e[1] != -1) {
PlayerHand[pIdx]->SelectCard(e[0]);
PlayerHand[pIdx]->SelectCard(e[1]);
if(e[2] != -1)
PlayerHand[pIdx]->SelectCard(e[2]);
return true;
}
return false;
}
示例8: IME_ERROR
int CRandomEvent::REventCardDrop(
CRole *pCRole,
int32_t ¶1,
int32_t ¶2,
int32_t ¶3,
int32_t ¶4
)
{
// IME_DEBUG("card drop event %u", CARD_GET);
std::vector<int> vecrate;
std::vector<STC_CONF_CARD_COLLECTION *> *p;
p = CConfCardCollection::Find(para1);
if (p->size() == 0)
{
IME_ERROR("can not find cardcollection index %u", para1);
para1 = 0;
para2 = 0;
para3 = 0;
return 0;
}
for (int i = 0; i < p->size(); i++)
{
vecrate.push_back((*p)[i]->byWeight);
}
int rel;
if ((rel = CUtil::RandFactor(vecrate)) == -1)
{
para1 = 0;
para2 = 0;
para3 = 0;
return 0;
}
if ((*p)[rel]->dwCardindex == 0)
{
para1 = 0;
para2 = 0;
para3 = 0;
return 0;
}
para1 = CARD_GET;
para2 = 0;
para3 = (*p)[rel]->dwCardindex;
uint32_t objid, opt;
pCRole->GetclsCardPacket()->CardAddByPara(para3, objid, opt, SOURCE_OTHER);
if (opt)
pCRole->GetclsCardPacket()->SingleCardAddUpdate(objid);
CCard *pCard = pCRole->GetclsCardPacket()->Find(objid);
if (pCard == NULL)
{
IME_ERROR("add this card fail %u", para3);
return -1;
}
para2 = pCard->GetbyStarLevel();
para3 = objid;
return 0;
}
示例9: switch
void CCardLabelNexus::showCardLabelToolTip(const CCard &card, int x, int y)
{
if (!mCardLabelToolTip->isVisible() && card.isValid())
{
const CGlobalConfig &cfg = CGlobalConfig::getCfg();
const CCardTable &cardTable = CCardTable::getCardTable();
mCardLabelToolTipSummonLabel->setVisible(false);
const QList<CCardSkill> &skills = card.getSkills();
QStringList skillDescr;
skillDescr.append(QString("<b>%1</b><br>").arg(card.getName()));
QString subTitleStr = card.isUnique() ? "Unique " : "";
switch(card.getFaction())
{
case EImperialFaction: subTitleStr += "Imperial"; break;
case EBloodthirstyFaction: subTitleStr += "Bloodthirsty"; break;
case EXenoFaction: subTitleStr += "Xeno"; break;
case ERighteousFaction: subTitleStr += "Righteous"; break;
case ERaiderFaction: subTitleStr += "Raider"; break;
default: break;
}
skillDescr.append(QString("<i>%1</i><table valign='middle'>").arg(subTitleStr));
for (int i = 0; i < skills.size(); ++i)
{
const CSkill& curSkill = cardTable.getSkillForId(skills.at(i).getId());
if (curSkill.isValid())
{
skillDescr.append(QString("<tr><td><img src='%1.png'/></td><td> %2</td></tr>")
.arg(cfg.getResourcePicturePath() + curSkill.getPicture())
.arg(curSkill.makeSignature(skills.at(i), true)));
if (curSkill.isSummon())
{
const CCard &summonCard = cardTable.getCardForId(skills.at(i).getX());
mCardLabelToolTipSummonLabel->setCard(summonCard);
mCardLabelToolTipSummonLabel->setVisible(true);
}
}
}
skillDescr.append(QString("</table>"));
mCardLabelToolTipText->setText(skillDescr.join(""));
mCardLabelToolTipLayout->activate();
mCardLabelToolTip->adjustSize();
int reqW = mCardLabelToolTip->width() + 5;
int reqH = mCardLabelToolTip->height() + 20;
int xRel = (QApplication::desktop()->width() - x < reqW)
? -reqW
: 5;
int yRel = (QApplication::desktop()->height() - y < reqH)
? -reqH
: 20;
mCardLabelToolTip->setGeometry(x + xRel, y + yRel, 80, 40);
mCardLabelToolTip->setVisible(true);
}
}
示例10: PlayBestCard
//
// PlayFourth()
//
// default implementation
//
CCard* CPlayEngine::PlayFourth()
{
CPlayerStatusDialog& status = *m_pStatusDlg;
status << "5PLAY4! Playing fourth, using default player logic.\n";
// use common code
CCard* pCard = PlayBestCard(4);
//
ASSERT(pCard->IsValid());
return pCard;
}
示例11: BBSetBackground
void CTable::Init()
{
unsigned char i = 0;
win_counter = 0;
BBSetBackground( BACK_C );
this->act_slot = BLOCK;
memset( changed, 0xFF, sizeof( changed ) );
block.RemoveAll();
block.Fill();
for( i = 0; i < 7; i++ )
block.Shuffle();
for( i = 0; i < 7; i++ )
tableau[i].RemoveAll();
for( i = 0; i < 4; i++ )
foundation[i].RemoveAll();
hand.RemoveAll();
wastepile.RemoveAll();
unsigned char filled;
for( filled = 1; filled < 7; filled++ )
{
for( i = filled; i < 7 ; i++ )
{
CCard tmp = block.PopCard();
tableau[i].PushCard( tmp, true );
}
}
for( i = 0; i < 7 ; i++ )
{
CCard tmp = block.PopCard();
tmp.Flip();
tableau[i].PushCard( tmp, true );
}
act_slot = BLOCK;
ChangeSelection( true );
}
示例12: Wizard
/* takes top card from the slot and movies it (if possible) to the foundation */
void CTable::Wizard()
{
CBuffer buffer;
CCard tmp;
CSlot* slot = NULL;
if( hand.GetCardsStored() ) return;
unsigned char prev_slot = act_slot;
switch( act_slot )
{
case BLOCK : this->DoAction(); break;
case WASTEPILE : slot = &wastepile; break;
case FOUNDATION1 : slot = &foundation[0]; break;
case FOUNDATION2 : slot = &foundation[1]; break;
case FOUNDATION3 : slot = &foundation[2]; break;
case FOUNDATION4 : slot = &foundation[3]; break;
case TABLEAU1 : slot = &tableau[0]; break;
case TABLEAU2 : slot = &tableau[1]; break;
case TABLEAU3 : slot = &tableau[2]; break;
case TABLEAU4 : slot = &tableau[3]; break;
case TABLEAU5 : slot = &tableau[4]; break;
case TABLEAU6 : slot = &tableau[5]; break;
case TABLEAU7 : slot = &tableau[6]; break;
}
if( slot )
{
tmp = slot->PeekCard();
if( false == tmp.IsValid() ) return;
for( unsigned char i = 0; i < 4; i++ )
{
if( foundation[i].PushCard( tmp ) )
{
changed[ FOUNDATION1 + i ] = true;
changed[ prev_slot ] = true;
slot->PopCard();
CheckWin( true );
return;
}
}
}
}
示例13: setCardWhiteListStatus
void CCardFilterParameters::setCardWhiteListStatus(const CCard &card, bool isWhite)
{
QSet<QString>::iterator iWhite = mWhiteList.find(card.getName());
if (iWhite == mWhiteList.end() && isWhite)
{
setCardBlackListStatus(card, false);
mWhiteList.insert(card.getName());
}
else if (iWhite != mWhiteList.end() && !isWhite)
{
mWhiteList.erase(iWhite);
}
}
示例14: OnClickedBtnOK
void CDlgAddCards::OnClickedBtnOK()
{
// TODO: 在此添加控件通知处理程序代码
//
int nCnt = m_proCard.GetPropertyCount();
for( int i = 0; i < nCnt; i++)
{
CMFCPropertyGridProperty* pProp = m_proCard.GetProperty(i);
if(!pProp || FALSE == pProp->IsEnabled())
continue;
CCardField* pField = (CCardField*)(pProp->GetData());
if(!pField)
continue;
CString sv = CXxwMfcPub::OleVar2Str(pProp->GetValue());
string sValue = sv.GetBuffer(0);
pField->sInstantValue = pField->FormatValue(sValue);//修改值
}
for(int r = 0; r < m_lstDevicesSelected.GetItemCount(); ++r)
{
CCardLine* pLine = (CCardLine*)(m_lstDevicesSelected.GetItemData(r));
CCard newCard = m_swiCard;
for (int i = 0 ; i < m_vecKeynames.size(); i++)
{
CCardField* pFld = pLine->m_card.FindFieldByKeyname(m_vecKeynames[i]);
CCardField* pFldNew = newCard.FindFieldByKeyname(m_vecKeynames[i]);
if (pFld && pFldNew)
{
pFldNew->sInstantValue = pFld->sInstantValue;//替换为选择的值
}
}
CCardLine* pLineNew = theApp.m_parserSwi.AddNewCard(newCard);//添加新卡
m_AllCardsNew.insert(make_pair(newCard.m_sName, pLineNew));
}
// 获得父窗口的句柄
HWND hWnd = m_pParentWnd->GetSafeHwnd();
// 向父窗口发送消息
if (hWnd == NULL)
return (void)MessageBox(_T("获得父窗口句柄失败!"));
::SendNotifyMessage(hWnd,WM_MY_ADDCARDS_OK,(WPARAM)0, (LPARAM)0);
//从“待选”中删除所有的行
m_lstDevicesSelected.DeleteAllItems();//删除所有的行
UpdateBtnOK();
SetFocus();//获得焦点并显示,以免被隐藏
}
示例15: updateCardLabelPicture
void CCardLabel::updateCardLabelPicture(const CCard& card)
{
if (mCard.getId() == card.getId())
{
setCard(card);
}
}