本文整理汇总了C++中Pile::RemoveTopCard方法的典型用法代码示例。如果您正苦于以下问题:C++ Pile::RemoveTopCard方法的具体用法?C++ Pile::RemoveTopCard怎么用?C++ Pile::RemoveTopCard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pile
的用法示例。
在下文中一共展示了Pile::RemoveTopCard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LButtonDblClk
// Called when the left button is double clicked
// If a card is under the pointer and it can move elsewhere then move it.
// Move onto a foundation as first choice, a populated base as second and
// an empty base as third choice.
// NB Cards in the m_pack cannot be moved in this way - they aren't in play
// yet
void Game::LButtonDblClk(wxDC& dc, int x, int y)
{
Pile* pile = WhichPile(x, y);
if (!pile) return;
// Double click on m_pack is the same as left button down
if (pile == m_pack)
{
LButtonDown(dc, x, y);
}
else
{
Card* card = pile->GetTopCard();
if (card)
{
int i;
// if the card is an ace then try to place it next
// to an ace of the same suit
if (card->GetPipValue() == 1)
{
for(i = 0; i < 4; i++)
{
Card* m_topCard = m_foundations[i]->GetTopCard();
if ( m_topCard )
{
if (m_topCard->GetSuit() == card->GetSuit() &&
m_foundations[i + 4] != pile &&
m_foundations[i + 4]->GetTopCard() == 0)
{
pile->RemoveTopCard(dc);
m_foundations[i + 4]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i + 4]);
return;
}
}
}
}
// try to place the card on a foundation
for(i = 0; i < 8; i++)
{
if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
{
pile->RemoveTopCard(dc);
m_foundations[i]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i]);
return;
}
}
// try to place the card on a populated base
for(i = 0; i < 10; i++)
{
if (m_bases[i]->AcceptCard(card) &&
m_bases[i] != pile &&
m_bases[i]->GetTopCard())
{
pile->RemoveTopCard(dc);
m_bases[i]->AddCard(dc, card);
DoMove(dc, pile, m_bases[i]);
return;
}
}
// try to place the card on any base
for(i = 0; i < 10; i++)
{
if (m_bases[i]->AcceptCard(card) && m_bases[i] != pile)
{
pile->RemoveTopCard(dc);
m_bases[i]->AddCard(dc, card);
DoMove(dc, pile, m_bases[i]);
return;
}
}
}
}
}
示例2: LButtonDblClk
// Called when the left button is double clicked
// If a card is under the pointer and it can move elsewhere then move it.
// Move onto a foundation as first choice, a populated base as second and
// an empty base as third choice.
// NB Cards in the m_pack cannot be moved in this way - they aren't in play
// yet
void Game::LButtonDblClk(wxDC& dc, int x, int y)
{
Pile* pile = WhichPile(x, y);
if (!pile) return;
// Double click on m_pack is the same as left button down
if (pile == m_pack)
{
LButtonDown(dc, x, y);
}
else
{
Card* card = pile->GetTopCard();
if (card)
{
int i;
// if the card is an ace then try to place it next
// to an ace of the same suit
if (card->GetPipValue() == 1)
{
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for(i = 0; i < 4; i++)
{
Card* m_topCard = m_foundations[i]->GetTopCard();
if ( m_topCard )
{
if (m_topCard->GetSuit() == card->GetSuit() &&
m_foundations[i + 4] != pile &&
m_foundations[i + 4]->GetTopCard() == 0)
{
pile->RemoveTopCard(dc);
m_foundations[i + 4]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i + 4]);
return;
}
}
}
}
// try to place the card on a foundation
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for(i = 0; i < 8; i++)
{
if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
{
pile->RemoveTopCard(dc);
m_foundations[i]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i]);
return;
}
}
// try to place the card on a populated base
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for(i = 0; i < 10; i++)
{
if (m_bases[i]->AcceptCard(card) &&
m_bases[i] != pile &&
m_bases[i]->GetTopCard())
{
pile->RemoveTopCard(dc);
m_bases[i]->AddCard(dc, card);
DoMove(dc, pile, m_bases[i]);
return;
}
}
// try to place the card on any base
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
//.........这里部分代码省略.........