コード例 #1
0
ファイル: game_board.cpp プロジェクト: merelalkar/zlpacman
void GameBoard::initialize(const CardList& cards)
{
	CardList columnCards;
	columnCards.reserve(6);

	const int k_numColumnsInFirstGroup = 4;
	const int k_numColumnsInSecondGroup = 6;
	const int k_numCardsInColumnFisrtGroup = 5;
	const int k_numCardsInColumnSecondGroup = 4;

	for(int i = 0; i < k_numColumnsInFirstGroup; i++)
	{
		CardList::const_iterator it_from = cards.begin() + i * k_numCardsInColumnFisrtGroup;
		CardList::const_iterator it_to = cards.begin() + (i + 1) * k_numCardsInColumnFisrtGroup;

		columnCards.insert(columnCards.begin(), it_from, it_to);
		m_cardColumns[i].initialize(columnCards);

		columnCards.clear();
	}
	
	const int k_totalCardsInFirstGroup = 20; //k_numColumnsInFirstGroup * k_numCardsInColumnFisrtGroup;
	for(int i = 0; i < k_numColumnsInSecondGroup; i++)
	{
		CardList::const_iterator it_from = cards.begin() + k_totalCardsInFirstGroup + i * k_numCardsInColumnSecondGroup;
		CardList::const_iterator it_to = cards.begin() + k_totalCardsInFirstGroup + (i + 1) * k_numCardsInColumnSecondGroup;

		columnCards.insert(columnCards.begin(), it_from, it_to);
		m_cardColumns[k_numColumnsInFirstGroup + i].initialize(columnCards);

		columnCards.clear();
	}

	m_cardDeck.initialize(SpiderGame::k_seriesToPass);
	m_buildedStackDeck.reset();
	m_scoreBoard.reset();	
}
コード例 #2
0
ファイル: gamelogdialog.cpp プロジェクト: infsega/bbpref
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);
}