当前位置: 首页>>代码示例>>C++>>正文


C++ CBuffer::PushCard方法代码示例

本文整理汇总了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]);
//.........这里部分代码省略.........
开发者ID:Aristotong,项目名称:neutrino-mp-plugins-max,代码行数:101,代码来源:Table.cpp


注:本文中的CBuffer::PushCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。