本文整理汇总了C++中CBuffer::PushCard方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::PushCard方法的具体用法?C++ CBuffer::PushCard怎么用?C++ CBuffer::PushCard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::PushCard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
void CTable::Load()
{
int SavShowCards = 0;
FILE* sav = fopen( GAMESDIR "/solitair.sav", "rb" );
if( sav == NULL ) return;
fread( &SavShowCards, 1, sizeof( SavShowCards ), sav );
if( ( SavShowCards != 3 ) && ( SavShowCards != 1 ) )
{
return;
}
ShowCards = SavShowCards;
fread( &win_counter, 1, sizeof( win_counter ), sav );
CCard card;
unsigned char CardsStored;
CBuffer buffer;
//Restore BLOCK
block.RemoveAll();
fread( &CardsStored, 1, sizeof( CardsStored ), sav );
buffer.RemoveAll();
for( unsigned char i = 0; i < CardsStored; i++ )
{
fread( &card, 1, sizeof( card ), sav );
buffer.PushCard( card, true );
}
for( unsigned char i = 0; i < CardsStored; i++ )
{
block.PushCard( buffer.PopCard(), true );
}
//Restore Wastepile
fread( &CardsStored, 1, sizeof( CardsStored ), sav );
buffer.RemoveAll();
for( unsigned char i = 0; i < CardsStored; i++ )
{
fread( &card, 1, sizeof( card ), sav );
buffer.PushCard( card, true );
}
for( unsigned char i = 0; i < CardsStored; i++ )
{
wastepile.PushCard( buffer.PopCard(), true );
}
//Restore HAND
int HSource;
fread( &HSource, 1, sizeof( HSource ), sav );
switch( HSource )
{
case 0:
hand.SetSource(NULL);
break;
case BLOCK:
hand.SetSource(&block);
break;
case WASTEPILE:
hand.SetSource(&wastepile);
break;
case FOUNDATION1:
hand.SetSource(&foundation[0]);
break;
case FOUNDATION2:
hand.SetSource(&foundation[1]);
break;
case FOUNDATION3:
hand.SetSource(&foundation[2]);
break;
case FOUNDATION4:
hand.SetSource(&foundation[3]);
break;
case TABLEAU1:
hand.SetSource(&tableau[0]);
break;
case TABLEAU2:
hand.SetSource(&tableau[1]);
break;
case TABLEAU3:
hand.SetSource(&tableau[2]);
break;
case TABLEAU4:
hand.SetSource(&tableau[3]);
break;
case TABLEAU5:
hand.SetSource(&tableau[4]);
break;
case TABLEAU6:
hand.SetSource(&tableau[5]);
//.........这里部分代码省略.........