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


C++ EList::Begin方法代码示例

本文整理汇总了C++中EList::Begin方法的典型用法代码示例。如果您正苦于以下问题:C++ EList::Begin方法的具体用法?C++ EList::Begin怎么用?C++ EList::Begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EList的用法示例。


在下文中一共展示了EList::Begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: beginMission


//.........这里部分代码省略.........
		commandersToLoad[0][2] = -1;
	}

	if (mission)
		mission->destroy();

	long numPlayers = 1;
	if ( MPlayer )
		MPlayer->getPlayers(numPlayers);
	long numMoversPerCommander[MAX_MC_PLAYERS] = {12, 12, 12, 9, 7, 6, 5, 4};
	Stuff::Vector3D dropZoneList[255]; // ubsurdly large, but sometimes we overrun this.
	long dropZoneID = 0;
	if (MPlayer) {
		//dropZoneID = MPlayer->commanderID;
		for (long i = 0; i < MAX_MC_PLAYERS; i++)
			if (commandersToLoad[i][0] == MPlayer->commanderID) {
				dropZoneID = i;
				break;
			}
		useUnlimitedAmmo = MPlayer->missionSettings.unlimitedAmmo;
	}

	mission->init((char*)(const char*)LogisticsData::instance->getCurrentMission(), missionLoadType, dropZoneID, dropZoneList, commandersToLoad, numMoversPerCommander[numPlayers - 1]);

	LogisticsData::instance->rpJustAdded = 0;

	if (MPlayer) {
		if (missionLoadType == MISSION_LOAD_MP_LOGISTICS) {
			EList< LogisticsMech*, LogisticsMech* > list;
			LogisticsData::instance->getForceGroup(list);

			long dropZoneIndex = 0;
			long numMechs = 0;
			for (EList< LogisticsMech*, LogisticsMech* >::EIterator iter = list.Begin(); !iter.IsDone(); iter++) {
				numMechs++;
				if ( !(*iter)->getPilot() )
					continue;
				CompressedMech mechData;
				mechData.lastMech = (list.Count() == numMechs);
				mechData.objNumber =  (*iter)->getFitID();
				mechData.commanderID = MPlayer->commanderID;
				mechData.baseColor = MPlayer->colors[MPlayer->playerInfo[MPlayer->commanderID].baseColor[BASECOLOR_TEAM]];
				mechData.highlightColor1 = MPlayer->colors[MPlayer->playerInfo[MPlayer->commanderID].stripeColor];
				mechData.highlightColor2 = MPlayer->colors[MPlayer->playerInfo[MPlayer->commanderID].stripeColor];
				strcpy(mechData.pilotFile, (*iter)->getPilot()->getFileName());
				strcpy(mechData.mechFile, (*iter)->getFileName());
				strcpy(mechData.variantName, (*iter)->getName());
				mechData.variantNum = (*iter)->getVariant()->getFileID();
				mechData.cBills = (*iter)->getVariant()->getCost();
				mechData.pos[0] = dropZoneList[dropZoneIndex].x;
				mechData.pos[1] = dropZoneList[dropZoneIndex++].y;
				mechData.designerMech = (*iter)->getVariant()->isDesignerMech();
				mechData.numComponents = (*iter)->getComponentCount();
				if (mechData.numComponents)	{
					long* componentList = (long*)systemHeap->Malloc(sizeof(long) * mechData.numComponents);
					long otherCount = mechData.numComponents;
					(*iter)->getComponents(otherCount, componentList);
					if (otherCount != mechData.numComponents)
						STOP(("Heidi's getComponentCount does not agree with count returned from getComponents"));
					for (long i = 0; i < mechData.numComponents; i++)
						mechData.components[i] = (unsigned char)componentList[i];
				}
				MPlayer->sendMissionSetup(0, 1, &mechData);
			}

			if (!MPlayer->waitTillMechDataReceived()) {
开发者ID:Jacic,项目名称:MechCommander2,代码行数:67,代码来源:logistics.cpp

示例2: reinitMechs

void MechBayScreen::reinitMechs()
{
	
	int count = 0;

	
	int maxUnits = 12;

	if ( MPlayer )
	{
		long playerCount;
		MPlayer->getPlayers( playerCount );
		if ( playerCount )
			maxUnits = MAX_MULTIPLAYER_MECHS_IN_LOGISTICS/playerCount;

		if ( maxUnits > 12 )
			maxUnits = 12;
	}

	for ( int j = 0; j < ICON_COUNT_Y; j++ )
	{
		for ( int i = 0; i < ICON_COUNT_X; i++ )
		{
			pIcons[count].setMech( 0 );
			if ( count >= maxUnits )
				pIcons[count].disable( true );
			else
				pIcons[count].disable( 0 );

			count++;
		}
	}


	forceGroupCount = 0;

	// initialize both the inventory and icon lists
	EList< LogisticsMech*, LogisticsMech* > mechList;
	LogisticsData::instance->getInventory( mechList );
	
	
	for ( EList< LogisticsMech*, LogisticsMech* >::EIterator iter = mechList.Begin();
		!iter.IsDone(); iter++ )
		{
			if ( (*iter)->getForceGroup() )
			{
				long FG = (*iter)->getForceGroup();

				if ( FG <= maxUnits )
				{
				
					pIcons[FG-1].setMech( (*iter) );
					pIcons[FG-1].setPilot( (*iter)->getPilot() );
					forceGroupCount++;
				}
				else 
					(*iter)->setForceGroup( 0 );
				
			}
		}
}
开发者ID:,项目名称:,代码行数:61,代码来源:

示例3: begin

void MechPurchaseScreen::begin()
{
	variantListBox.removeAllItems(true);
	inventoryListBox.removeAllItems(true);
	// initialize both the inventory and icon lists
	EList< LogisticsMech*, LogisticsMech* > mechList;
	LogisticsData::instance->getInventory(mechList);
	prevInventory.Clear();
	LogisticsMech* pSelMech = 0;
	oldCBillsAmount = LogisticsData::instance->getCBills();
	for(EList< LogisticsMech*, LogisticsMech* >::EIterator iter = mechList.Begin();
			!iter.IsDone(); iter++)
	{
		if((*iter)->getForceGroup())
			continue;
		prevInventory.Append(*(*iter));
		bool bFound = 0;
		for(size_t i = 0; i < inventoryListBox.GetItemCount(); i++)
		{
			if(((MechListBoxItem*)inventoryListBox.GetItem(i))->getMech()->getVariant()
					== (*iter)->getVariant())
				bFound = true;
		}
		if(!bFound)
		{
			MechListBoxItem* item = new MechListBoxItem((*iter), 1);
			inventoryListBox.AddItem(item);
		}
	}
	MechListBoxItem* item = (MechListBoxItem*)inventoryListBox.GetItem(0);
	if(item)
	{
		inventoryListBox.SelectItem(0);
		pSelMech = item->getMech();
	}
	LogisticsVariant* pVariants[256];
	int32_t count = 256;
	LogisticsData::instance->getPurchasableMechs(pVariants, count);
	for(size_t i = 0; i < count; i++)
	{
		if(!MPlayer || MPlayer->missionSettings.variants || pVariants[i]->isDesignerMech())
		{
			LogisticsMech* pMech = new LogisticsMech(pVariants[i], -1);
			MechListBoxItem* item = new MechListBoxItem(pMech, 1);
			variantListBox.AddItem(item);
		}
	}
	if(!pSelMech)
	{
		MechListBoxItem* item = (MechListBoxItem*)variantListBox.GetItem(0);
		if(item)
		{
			variantListBox.SelectItem(0);
			pSelMech = item->getMech();
		}
	}
	status = RUNNING;
	acceptPressed = 0;
	inventoryListBox.drawCBills(1);
	variantListBox.drawCBills(1);
	variantListBox.setOrange(0);
	inventoryListBox.setOrange(1);
	setMech(pSelMech);
	pDragMech = nullptr;
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:65,代码来源:mechpurchasescreen.cpp

示例4: begin

void MechBayScreen::begin()
{
	status = RUNNING;

	pDragMech = NULL;

	mechListBox.removeAllItems( true );
	reinitMechs();	

	int mechCount[256];
	memset( mechCount, 0, sizeof ( int ) * 256 );

	bool bCurMechIsValid = 0;

	// initialize both the inventory and icon lists
	EList< LogisticsMech*, LogisticsMech* > mechList;
	LogisticsData::instance->getInventory( mechList );
	
	for ( EList< LogisticsMech*, LogisticsMech* >::EIterator iter = mechList.Begin();
		!iter.IsDone(); iter++ )
		{
			if ( *iter == pCurMech )
				bCurMechIsValid = true;

			if ( !(*iter)->getForceGroup() )
			{
				bool bFound = 0;

				for ( int i = 0; i < mechListBox.GetItemCount(); i++ )
				{
					if ( ((MechListBoxItem*)mechListBox.GetItem(i))->getMech()->getVariant()
						== (*iter)->getVariant() )
						bFound = true;
				}

				if ( !bFound )
				{
					MechListBoxItem* item = new MechListBoxItem( (*iter), 1 );
					mechListBox.AddItem( item );
				}

			}
		}

	
	
	// reset the old mech to NULL to make sure everything gets set
	
	mechListBox.drawCBills( 0 );
	mechListBox.setOrange( true );

	if ( !pCurMech || !bCurMechIsValid )
	{
		if ( !selectFirstFGItem() )
		{
			if ( !selectFirstViableLBMech() )
				setMech( NULL );
		}
	}
	else
	{
		LogisticsMech* pMech = pCurMech;
		setMech( NULL ); // need to make sure the guy is still running
		setMech( pMech );

		bool bFound = 0;
		for ( int i = 0; i < mechListBox.GetItemCount(); i++ )
		{
			MechListBoxItem* pItem = (MechListBoxItem*)mechListBox.GetItem( i );
			if ( pItem && pItem->getMech() == pCurMech )
			{
				mechListBox.SelectItem( i );
				bFound = true;
			}
		}

		if ( !bFound )
		{
			for ( int i = 0; i < ICON_COUNT; i++ )
			{
				if ( pIcons[i].getMech() == pMech )
				{
					pIcons[i].select( true );
					break;
				}
			}
		}
	}
	
}
开发者ID:,项目名称:,代码行数:90,代码来源:

示例5: begin

void PilotReadyScreen::begin()
{
	getButton( MB_MSG_PREV )->disable( false );
	getButton( MB_MSG_MAINMENU )->disable( false );
	launchFadeTime = 0;
	// initialize both the inventory and icon lists
	EList< LogisticsMech*, LogisticsMech* > mechList;
	LogisticsData::instance->getInventory( mechList );

	// reset force group
	forceGroupCount = 0;
	
	int maxUnits = 12;

	if ( MPlayer )
	{
		long playerCount;
		MPlayer->getPlayers( playerCount );
		if ( playerCount )
			maxUnits = MAX_MULTIPLAYER_MECHS_IN_LOGISTICS/playerCount;

		if ( maxUnits > 12 )
			maxUnits = 12;
	}

	for ( int i = 0; i < 12; i++ )
	{
		pIcons[i].setMech( 0 );
		pIcons[i].select( 0 );

		if ( i >= maxUnits )
			pIcons[i].disable( 1 );
		else
			pIcons[i].disable( 0 );

	}
	
	if ( getButton( MB_MSG_MAINMENU ) )
		getButton( MB_MSG_MAINMENU )->setPressFX( -1 );

	int bHasPilot = -1;
	

		// update pilot use here... things can get screwed up.
	

		pilotListBox.removeAllItems( true );

		long count = 256;
		LogisticsPilot* pilots[256];
		LogisticsData::instance->getPilots( pilots, count );

		for ( i = 0; i < count; i++ )
		{
			pilots[i]->setUsed(0);
		}


		for ( EList< LogisticsMech*, LogisticsMech* >::EIterator iter = mechList.Begin();
		!iter.IsDone(); iter++ )
		{
			if ( (*iter)->getForceGroup() )
			{
				long FG = (*iter)->getForceGroup();
				pIcons[FG-1].setMech( (*iter) );
				if ( (*iter)->getPilot() )
				{
					(*iter)->getPilot()->setUsed( true );
					pIcons[FG-1].setPilot( (*iter)->getPilot() );
					bHasPilot = FG - 1;
				}

				forceGroupCount++;
			}
		}

		for ( i = 0; i < count; i++ )
		{
			if ( !pilots[i]->isUsed() && pilots[i]->isAvailable() )
			{
				pilotListBox.AddItem( new LogisticsPilotListBoxItem( pilots[i] ) );				
			}
		}



		status = RUNNING;

		if ( bHasPilot != -1 )
		{
			pIcons[bHasPilot].select( true );
			setPilot( pIcons[bHasPilot].getPilot() );
		}
		else
		{
			LogisticsPilotListBoxItem* pItem = ( LogisticsPilotListBoxItem*)pilotListBox.GetItem( 0 );
			if ( pItem )
			{
				pilotListBox.SelectItem( 0 );
				setPilot( pItem->getPilot() );
//.........这里部分代码省略.........
开发者ID:wolfman-x,项目名称:mechcommander2,代码行数:101,代码来源:pilotreadyscreen.cpp


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