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


C++ MoverPtr::getObjectClass方法代码示例

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


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

示例1: eject

void Team::eject(void)
{
	for(size_t i = 0; i < rosterSize; i++)
	{
		MoverPtr mover = (MoverPtr)ObjectManager->getByWatchID(roster[i]);
		if(mover)
		{
			if(mover->getObjectClass() == BATTLEMECH)
				mover->getPilot()->orderEject(false, true, ORDER_ORIGIN_COMMANDER);
			else
			{
				WeaponShotInfo shot;
				shot.init(nullptr, -3, 254.0, 0, 0);
				mover->handleWeaponHit(&shot, (MPlayer != nullptr));
			}
		}
	}
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:18,代码来源:team.cpp

示例2: findBestSpotter

SensorSystemPtr TeamSensorSystem::findBestSpotter (MoverPtr contact, long* status) {

	ContactInfoPtr contactInfo = contact->getContactInfo();
	if (!contactInfo) {
		char s[256];
		sprintf(s, "TeamSensorSystem.findBestSpotter: NULL contactInfo for objClass %d partID %d team %d", contact->getObjectClass(), contact->getPartId(), contact->getTeamId());
		STOP((s));
	}
	SensorSystemPtr bestSensor = NULL;
	long bestStatus = CONTACT_NONE;
	for (long i = 0; i < MAX_SENSORS; i++)
		if (contactInfo->sensors[i] != 255) {
			SensorSystemPtr sensor = SensorManager->getSensor(i);
			if (sensor && sensor->owner && (teamId == sensor->owner->getTeamId())) {
				long status = sensor->calcContactStatus(contact);
				if (status >= bestStatus) {
					bestSensor = sensor;
					bestStatus = status;
				}
			}
		}
	if (status)
		*status = bestStatus;
	return(bestSensor);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:25,代码来源:Contact.cpp

示例3: beginMission


//.........这里部分代码省略.........
							MoverInitData data;
							memset(&data, 0, sizeof(MoverInitData));
							data.objNumber = MPlayer->mechData[i][j].objNumber;
							data.rosterIndex = 255;
							data.controlType = 2;
							data.controlDataType = 1;
							data.position.x = MPlayer->mechData[i][j].pos[0];
							data.position.y = MPlayer->mechData[i][j].pos[1];
							data.position.z = 0.0;
							data.rotation = 0;
							data.teamID = MPlayer->playerInfo[MPlayer->mechData[i][j].commanderID].team;
							data.commanderID = MPlayer->mechData[i][j].commanderID;
							data.baseColor = MPlayer->mechData[i][j].baseColor;
							data.highlightColor1 = MPlayer->mechData[i][j].highlightColor1;
							data.highlightColor2 = MPlayer->mechData[i][j].highlightColor2;
							data.gestureID = 2;
							data.active = 1;
							data.exists = 1;
							data.capturable = 0;
							data.icon = 0;
							
							strcpy(data.pilotFileName, MPlayer->mechData[i][j].pilotFile);
							strcpy(data.brainFileName, "pbrain");
							strcpy(data.csvFileName, MPlayer->mechData[i][j].mechFile);
							data.numComponents = MPlayer->mechData[i][j].numComponents;
							for (long k = 0; k < MPlayer->mechData[i][j].numComponents; k++)
								data.components[k] = MPlayer->mechData[i][j].components[k];
							long moverHandle = mission->addMover(&data);
							if (moverHandle < 1)
								STOP(("Logistics.beginMission: unable to addMover"));
							MoverPtr mover = (MoverPtr)ObjectManager->get(moverHandle);
							if (!mover)
								STOP(("Logistics.beginMission: NULL mover"));
							if (mover->getObjectClass() != BATTLEMECH)
								STOP(("Logistics.beginMission: not a mech"));
							((BattleMech*)mover)->cBills = MPlayer->mechData[i][j].cBills;
							strcpy(((BattleMech*)mover)->variantName, MPlayer->mechData[i][j].variantName);
							data.variant = MPlayer->mechData[i][j].variantNum;
						}
					}
				}
			}
		}
		else // gotta update pilot availability
		{
			long count = 256;
			LogisticsPilot* pilots[256];
			LogisticsData::instance->getPilots( pilots, count );

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

			Team* pTeam = Team::home;

			if ( pTeam )
			{
				for ( i = pTeam->getRosterSize() - 1; i > -1; i-- )
				{
					Mover* pMover = (Mover*)pTeam->getMover( i );
					if ( pMover && pMover->getCommander()->getId() == Commander::home->getId() )
					{
						LogisticsPilot* pPilot = LogisticsData::instance->getPilot( pMover->getPilot()->getName() );
						if ( pPilot )
							pPilot->setUsed( true );
开发者ID:Jacic,项目名称:MechCommander2,代码行数:67,代码来源:logistics.cpp

示例4: calcJumpGoals

long MoverGroup::calcJumpGoals (Stuff::Vector3D goal, long numMovers, Stuff::Vector3D* goalList, GameObjectPtr DFATarget) {

	long numJumping = 0;

	//-----------------------------
	// First, build the jump map...
	long jumpMap[JUMPMAP_CELL_DIM][JUMPMAP_CELL_DIM];

	//------------------------------------------------------------
	// The initial goal tile is placed at the center of the map...
	long goalCell[2] = {0, 0};
	land->worldToCell(goal, goalCell[0], goalCell[1]);

	long mapCellUL[2] = {0, 0};
	mapCellUL[0] = goalCell[0] - JUMPMAP_CELL_DIM / 2;
	mapCellUL[1] = goalCell[1] - JUMPMAP_CELL_DIM / 2;

	// -1 = OPEN
	// -2 = BLOCKED
	// 0 thru # = already selected for that # mover in the group
	for (long r = 0; r < JUMPMAP_CELL_DIM; r++)
		for (long c = 0; c < JUMPMAP_CELL_DIM; c++) {
			long cellRow = mapCellUL[0] + r;
			long cellCol = mapCellUL[1] + c;
			if (GameMap->inBounds(cellRow, cellCol)) {
				MapCellPtr mapCell = GameMap->getCell(cellRow, cellCol);

				//-----------------------
				// Tile (terrain) type...
				//long tileType = curTile.getTileType();
				if (!mapCell->getPassable())
					jumpMap[r][c] = -2;
				else
					jumpMap[r][c] = -1;

#ifdef USE_OVERLAYS_IN_MC2
				long overlay = mapCell->getOverlay();
				if (OverlayIsBridge[overlay]) {
					switch (overlay) {
						case OVERLAY_WATER_BRIDGE_NS:
						case OVERLAY_RAILROAD_WATER_BRIDGE_NS:
							jumpMap[row][col] = -2;
							jumpMap[row][col + 2] = -2;
							jumpMap[row + 1][col] = -2;
							jumpMap[row + 1][col + 2] = -2;
							jumpMap[row + 2][col] = -2;
							jumpMap[row + 2][col + 2] = -2;
							break;
						case OVERLAY_WATER_BRIDGE_EW:
						case OVERLAY_RAILROAD_WATER_BRIDGE_EW:
							jumpMap[row][col] = -2;
							jumpMap[row][col + 1] = -2;
							jumpMap[row][col + 2] = -2;
							jumpMap[row + 2][col] = -2;
							jumpMap[row + 2][col + 1] = -2;
							jumpMap[row + 2][col + 2] = -2;
							break;
						case OVERLAY_WATER_BRIDGE_NS_DESTROYED:
						case OVERLAY_RAILROAD_WATER_BRIDGE_NS_DESTROYED:
						case OVERLAY_WATER_BRIDGE_EW_DESTROYED:
						case OVERLAY_RAILROAD_WATER_BRIDGE_EW_DESTROYED:
							jumpMap[row][col] = -2;
							jumpMap[row][col + 1] = -2;
							jumpMap[row][col + 2] = -2;
							jumpMap[row + 1][col] = -2;
							jumpMap[row + 1][col + 1] = -2;
							jumpMap[row + 1][col + 2] = -2;
							jumpMap[row + 2][col] = -2;
							jumpMap[row + 2][col + 1] = -2;
							jumpMap[row + 2][col + 2] = -2;
							break;
					}
				}
#endif
				}
			else
				jumpMap[r][c] = -2;
		}

	long moverCount = ObjectManager->getNumMovers();
	for (long i = 0; i < moverCount; i++) {
		MoverPtr mover = ObjectManager->getMover(i);
		if ((mover->getObjectClass() != ELEMENTAL) && (mover != DFATarget) && !mover->isDisabled()) {
			long mapCellRow, mapCellCol;
			mover->getCellPosition(mapCellRow, mapCellCol);
			mapCellRow -= mapCellUL[0];
			mapCellCol -= mapCellUL[1];
			if (inMapBounds(mapCellRow, mapCellCol, JUMPMAP_CELL_DIM, JUMPMAP_CELL_DIM))
				jumpMap[mapCellRow][mapCellCol] = -2;
		}
	}

#ifdef _DEBUG
#if DEBUGJUMPGOALS
	char debugStr[256];
	sprintf(debugStr, "GROUP JUMP(%.2f,%.2f,%.2f)--UL = %d,%d: ", goal.x, goal.y, goal.z,mapCellUL[0], mapCellUL[1]);
#endif
#endif

	//-----------------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:101,代码来源:group.cpp


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