本文整理汇总了C++中CardList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ CardList::count方法的具体用法?C++ CardList::count怎么用?C++ CardList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CardList
的用法示例。
在下文中一共展示了CardList::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main()
{
BeastCubeManager beastCube;
for(CubeID cube : CubeSet::connected())
{
//LOG("###---Player %i---\n", cube);
CardList c = (CardFactory::getCards(2));
for(int i = 0; i < c.count(); i++)
{
LOG("###%i %i\n", c[i].type, c[i].power);
}
Card beastCards[] = {c.pop_back(), c.pop_back()};
Beast m = BeastFactory::createBeast(beastCards, 2);
LOG("###Player %i beast\nType: %i\nAttack:%i\nHealth:%i\nResolve:%i\nAnger:%i\n\n",
-1, m.type, m.attack, m.health, m.resolve, m.anger);
beastCube.init(cube, m);
}
while(1)
System::paint();
}
示例2: redeal
// Add cards from pile to deck, in reverse direction
void Klondike::redeal() {
CardList pilecards = pile->cards();
if (EasyRules)
// the remaining cards in deck should be on top
// of the new deck
pilecards += deck->cards();
for (int count = pilecards.count() - 1; count >= 0; --count)
{
Card *card = pilecards[count];
card->setAnimated(false);
deck->add(card, true, false); // facedown, nospread
}
redealt = true;
}
示例3: showDeal
void GameLogDialog::showDeal(const int row)
{
Q_ASSERT(row < model->gameLog().size());
QString output;
for (int i=1; i<=3; i++)
{
output += QString("%1: ").arg(model->player(i)->nick());
CardList cl;
foreach(const Card& c, model->gameLog().at(row).cardList[i-1])
cl.insert(const_cast<Card*>(&c));
cl.mySort();
for( int ci = 0; ci < cl.count(); ci++ )
{
output += cl.at(ci)->toUniString();
output += ' ';
}
output += '\n';
}
QMessageBox::about(0, tr("Deal #") + QString::number(row + 1), output);
}
示例4: main
void main()
{
Game game = Game();
CardList cards;
//Player playerOne;
BeastCubeManager beastCube(&game);
Hand gameHand(0);
//Hand::playerOneCards = (CardFactory::getCards(5));
//Hand::playerTwoCards = (CardFactory::getCards(4));
//Hand::convertToMenu(1, Hand::playerOneCards);
Hand::drawHand();
Menu m(Hand::handBuffer, &gAssets, Hand::playerOneHand);
m.anchor(0);
//Make beasts
for(int cube = 1; cube < CubeSet::connected().count(); ++cube) {
LOG("###---Player %i---\n", cube);
//CardList c = (CardFactory::getCards(2));
CardFactory::getCards(&cards, 2);
for(int i = 0; i < cards.count(); i++)
{
LOG("###Card for beast creation: %i %i\n", cards[i].type, cards[i].power);
}
Card beastCards[] = {cards.pop_back(), cards.pop_back()};
Beast m = BeastFactory::createBeast(beastCards, 2);
LOG("###Beast created:\n Type: %i\n Attack:%i\n Health:%i\n Resolve:%i\n Anger:%i\n\n",
m.type, m.attack, m.health, m.resolve, m.anger);
beastCube.init(cube, m);
cards.clear();
}
struct MenuEvent e;
uint8_t item;
int target = 0;
while(1)
{
System::paint();
while (m.pollEvent(&e)) {
if(game.newTurn)
{
//LOG("New turn!\n");
//Hand::drawCard(game.activePlayerIndex + 1);
//if(game.activePlayerIndex == 0)
// m.init(Hand::handBuffer, &gAssets, Hand::playerOneHand);
//else
// m.init(Hand::handBuffer, &gAssets, Hand::playerTwoHand);
Hand::drawHand();
game.newTurn = false;
}
switch (e.type) {
case MENU_ITEM_PRESS:
// // Game Buddy is not clickable, so don't do anything on press
// if (e.item >= 3) {
// // Prevent the default action
// continue;
// } else {
// m.anchor(e.item);
// }
// if (e.item == 4) {
// static unsigned randomIcon = 0;
// randomIcon = (randomIcon + 1) % e.item;
// m.replaceIcon(e.item, Hand::playerOneHand[randomIcon].icon, Hand::playerOneHand[randomIcon].label);
// }
if(target != 0)
{
Card c;
c = Hand::playerOneCards[e.item];
game.cardAction(&beastCube.beasts[target], &c);
beastCube.refresh(target);
game.newTurn = true;
}
break;
case MENU_EXIT:
// this is not possible when pollEvent is used as the condition to the while loop.
// NOTE: this event should never have its default handler skipped.
ASSERT(false);
break;
case MENU_NEIGHBOR_ADD:
//LOG("found cube %d on side %d of menu (neighbor's %d side)\n",
//e.neighbor.neighbor, e.neighbor.masterSide, e.neighbor.neighborSide);
target = e.neighbor.neighbor;
break;
case MENU_NEIGHBOR_REMOVE:
//LOG("lost cube %d on side %d of menu (neighbor's %d side)\n",
// e.neighbor.neighbor, e.neighbor.masterSide, e.neighbor.neighborSide);
if(e.neighbor.neighbor == target)
//.........这里部分代码省略.........