本文整理汇总了C++中CCard::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ CCard::getNext方法的具体用法?C++ CCard::getNext怎么用?C++ CCard::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCard
的用法示例。
在下文中一共展示了CCard::getNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: distributeBoard
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));
}
}
示例2: sendShowdown
int CpduShowdown::sendShowdown(CPlayer* player,
int numCards,
const char* message)
{
// Sending dummy cards for now!
CCard *pCard = player->getHand()->getCard();
int msglen = (message != NULL ? strlen(message) : 0);
length_ += numCards * sizeof(pdu_card) + msglen;
stuffHeader();
if (length_ < MAXBUFFERSIZE)
{
char* buf = value_ + PDU_HEADER_SIZE;
pdu_showdown data;
data.slot = htons(player->getSlot());
data.numCards = htons(numCards);
data.msglen = htons(msglen);
memcpy(buf, &data, sizeof(data));
buf += sizeof(data);
// copy cards to buffer
for (int i = 0; i < numCards; i++)
{
pdu_card card;
card.suit = htons(pCard->getSuit());
card.value = htons(pCard->getValue());
memcpy(buf, &card, sizeof(card));
buf += sizeof(card);
pCard = pCard->getNext();
}
// copy showdown message to buffer
if (msglen > 0)
memcpy(buf, message, msglen);
return broadcastTo(table_->getRing());
}
else
{
Sys_LogError("CpduShowdown: buffer size too small.\n");
return 0;
}
}
示例3: while
// In 7-stud, the odd chip goes to player with
// highest card of suit in this order:
// Spades, Hearts, Diamonds, Clubs.
CPlayer* Cplm_7Stud::getOddChipWinner(Winners& winners)
{
CPlayer* player = NULL;
u_int16_t highestCard = 0;
for (Winners::iterator it = winners.begin(),
end = winners.end();
it != end;
++it)
{
CWinner& winnerEntry = const_cast<CWinner&>(*it);
CPlayer* winner = winnerEntry.player_;
if (winner && winner->hasHand())
{
Chand* hand = winner->getHand();
if (hand)
{
CCard* card = hand->getCard();
while (card != NULL)
{
u_int16_t thisCard = card->getSuit() * 13 + card->getValue();
if (thisCard > highestCard)
{
highestCard = thisCard;
player = winner;
}
card = card->getNext();
}
}
}
}
if (!player)
player = getPlayerClosestToLeftOfDealer(winners);
return player;
}