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


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

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


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

示例1: removeFromRoster

void Team::removeFromRoster(MoverPtr mover)
{
	for(size_t i = 0; i < rosterSize; i++)
		if(roster[i] == mover->getWatchID())
		{
			roster[i] = roster[--rosterSize];
			break;
		}
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:9,代码来源:team.cpp

示例2: isMember

bool MoverGroup::isMember(MoverPtr mover)
{
	if (!mover)
		return (false);
	GameObjectWatchID moverWID = mover->getWatchID();
	for (size_t i = 0; i < numMovers; i++)
		if (moverWIDs[i] == moverWID)
			return (true);
	return (false);
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:10,代码来源:group.cpp

示例3: add

bool MoverGroup::add(MoverPtr mover)
{
	if (numMovers == MAX_MOVERGROUP_COUNT)
	{
		Fatal(0, " MoverGroup.add: Group too big ");
		//----------------------------------------
		// Should we choose to remove the fatal...
		return (false);
	}
	moverWIDs[numMovers++] = mover->getWatchID();
	mover->setGroupId(id, true);
	return (true);
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:13,代码来源:group.cpp

示例4: setPoint

long MoverGroup::setPoint (MoverPtr mover) {

	if (isMember(mover)) {
#ifdef USE_IFACE
		if (pointHandle)
			theInterface->setPoint(pointHandle, false);
#endif
		pointWID = mover->getWatchID();
#ifdef USE_IFACE
		theInterface->setPoint(mover->getPartId(), true);
#endif
	}

	return(NO_ERR);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:15,代码来源:group.cpp

示例5: buildRoster

void Team::buildRoster(void)
{
	//---------------------------------------------------------------------
	// This function builds a roster for the team from the movers currently
	// registered in the object manager. It assumes the teamId is already
	// set for each mover, and compares this team's id to that of the
	// objects to determine which objects belong on this team...
	rosterSize = 0;
	for(size_t i = 0; i < ObjectManager->getNumMovers(); i++)
	{
		MoverPtr mover = ObjectManager->getMover(i);
		if(mover->getTeamId() == id)
			roster[rosterSize++] = mover->getWatchID();
	}
//	numMechs = objClassTally[0];
//	numVehicles = objClassTally[1];
//	numElementals = objClassTally[2];
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:18,代码来源:team.cpp

示例6: remove

bool MoverGroup::remove (MoverPtr mover) {

	GameObjectWatchID moverWID = mover->getWatchID();
	if (moverWID == pointWID) {
		disband();
		return(true);
		}
	else {
		for (long i = 0; i < numMovers; i++)
			if (moverWIDs[i] == moverWID) {
				mover->setGroupId(-1, true);
				moverWIDs[i] = moverWIDs[numMovers - 1];
				moverWIDs[numMovers - 1] = 0;
				numMovers--;
				return(true);
			}
	}
	return(false);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:19,代码来源:group.cpp

示例7: setHit

void TriggerAreaManager::setHit (MoverPtr mover) {

#if 1
	for (long i = 0; i < MAX_TRIGGER_AREAS; i++) {
		if (triggerAreas[i].type == TRIGGER_AREA_NONE)
			continue;
		if (mover->cellPositionRow >= triggerAreas[i].dim[0])
			if (mover->cellPositionRow < triggerAreas[i].dim[2])
				if (mover->cellPositionCol >= triggerAreas[i].dim[1])
					if (mover->cellPositionCol < triggerAreas[i].dim[3])
						switch (triggerAreas[i].type) {
							case TRIGGER_AREA_MOVER:
								if (triggerAreas[i].param > 0) {
									if (mover->getWatchID() == triggerAreas[i].param)
										triggerAreas[i].hit = true;
									}
								else
									triggerAreas[i].hit = true;
								break;
							case TRIGGER_AREA_TEAM:
								if (mover->getTeamId() == triggerAreas[i].param) {
									triggerAreas[i].hit = true;
								//sprintf(s, "AREA HIT: %d", i);
								//DEBUGWINS_print(s, 0);
								}
								break;
							case TRIGGER_AREA_GROUP:
								if (mover->getGroupId() == triggerAreas[i].param)
									triggerAreas[i].hit = true;
								break;
							case TRIGGER_AREA_COMMANDER:
								if (mover->getCommanderId() == triggerAreas[i].param)
									triggerAreas[i].hit = true;
								break;
						}
	}
#else
	long areaHandle = map[mover->cellPositionRow / 3][mover->cellPositionCol / 3];
	if (areaHandle > 0) {
		switch (triggerAreas[areaHandle].type) {
			case TRIGGER_AREA_MOVER:
				if (triggerAreas[areaHandle].param > 0) {
					if (mover->getWatchID() == triggerAreas[areaHandle].param)
						triggerAreas[areaHandle].hit = true;
					}
				else
					triggerAreas[areaHandle].hit = true;
				break;
			case TRIGGER_AREA_TEAM:
				if (mover->getTeamId() == triggerAreas[areaHandle].param)
					triggerAreas[areaHandle].hit = true;
				break;
			case TRIGGER_AREA_GROUP:
				if (mover->getGroupId() == triggerAreas[areaHandle].param)
					triggerAreas[areaHandle].hit = true;
				break;
			case TRIGGER_AREA_COMMANDER:
				if (mover->getCommanderId() == triggerAreas[areaHandle].param)
					triggerAreas[areaHandle].hit = true;
				break;
		}
	}
#endif
}
开发者ID:,项目名称:,代码行数:64,代码来源:

示例8: handleTacticalOrder

long MoverGroup::handleTacticalOrder (TacticalOrder tacOrder, long priority, Stuff::Vector3D* jumpGoalList, bool queueGroupOrder) {

	if (numMovers == 0)
		return(NO_ERR);

	if (queueGroupOrder)
		tacOrder.pack(NULL, NULL);

	//bool processOrder = true;
	bool isJump = false;
	bool isMove = false;
	Stuff::Vector3D goalList[MAX_MOVERGROUP_COUNT];
	Stuff::Vector3D location = tacOrder.getWayPoint(0);
	//MoverPtr pointVehicle = getPoint();

	if (tacOrder.code == TACTICAL_ORDER_ATTACK_OBJECT)
		if (tacOrder.attackParams.method == ATTACKMETHOD_DFA) {
			//-------------------------------------------------
			// Let's just make it a move/jump order, for now...
			tacOrder.code = TACTICAL_ORDER_JUMPTO_OBJECT;
			tacOrder.moveParams.wait = false;
			tacOrder.moveParams.wayPath.mode[0] = TRAVEL_MODE_SLOW;
			GameObjectPtr target = ObjectManager->getByWatchID(tacOrder.targetWID);
			Assert(tacOrder.targetWID != 0, 0, " DFA AttackObject WID is 0 ");
			if (!target)
				return(NO_ERR);
			tacOrder.setWayPoint(0, target->getPosition());
		}
	if (tacOrder.code == TACTICAL_ORDER_JUMPTO_OBJECT) {
		tacOrder.code = TACTICAL_ORDER_JUMPTO_POINT;
		GameObjectPtr target = ObjectManager->get(tacOrder.targetWID);
		Assert(tacOrder.targetWID != 0, 0, " DFA AttackObject WID is 0 ");
		if (!target)
			return(NO_ERR);
		tacOrder.setWayPoint(0, target->getPosition());
	}

	//vector_3d offsetTable[MAX_GROUPMOVE_OFFSETS];
	//long numOffsets = 0;

	switch (tacOrder.code) {
		case TACTICAL_ORDER_WAIT:
			break;

		case TACTICAL_ORDER_MOVETO_POINT:
		case TACTICAL_ORDER_MOVETO_OBJECT: {
Fatal(0, "Need to support jumpGoalList (and goalList) for MOVETO as well in mc2 ");
			isMove = true;
			//-----------------------------------------------------------
			// Sort by distance to destination. Their selectionIndex will
			// be set to modify this goal...
			SortListPtr list = Mover::sortList;
			if (list) {
				list->clear(false);
				long moverCount = 0;
				for (long i = 0; i < numMovers; i++) {
					MoverPtr mover = getMover(i);
					Assert(mover != NULL, moverWIDs[i], " MoverGroup.handleTacticalOrder: NULL mover ");
					if (!mover->isDisabled()) {
						list->setId(moverCount, i);
						list->setValue(moverCount, mover->distanceFrom(location));
						moverCount++;
					}
				}
				list->sort(false);
				//--------------------------------
				// Let's build the offset table...
				/*
				numOffsets = moverCount - 1;
				if (numOffsets > MAX_GROUPMOVE_OFFSETS)
					numOffsets = MAX_GROUPMOVE_OFFSETS;
				long offsetsStart = GroupMoveOffsetsIndex[numOffsets - 1];
				for (i = 0; i < numOffsets; i++)
					offsetTable[i] = relativePositionToPoint(location, GroupMoveOffsets[offsetsStart + i][0], GroupMoveOffsets[offsetsStart + i][1], RELPOS_FLAG_PASSABLE_START);
				*/
				//-----------------------------------
				// Now, calc the order of movement...
				long curIndex = 1;
				for (i = 0; i < moverCount; i++) {
					MoverPtr mover = getMover(list->getId(i));
					if (mover->getWatchID() == pointWID)
						mover->selectionIndex = 0;
					else
						mover->selectionIndex = curIndex++;
				}
			}
			}
			break;

		case TACTICAL_ORDER_JUMPTO_POINT:
		case TACTICAL_ORDER_JUMPTO_OBJECT: {
			//-----------------------------------------------------------
			// Sort by distance to destination. Their selectionIndex will
			// be set to modify this goal...
			isJump = true;
			//-------------------------------------------------------------------------
			// We can assume that all movers in this group are jump-capable. Otherwise,
			// the group wouldn't be allowed to jump by the interface. In addition,
			// we KNOW that all movers in this group can jump to the selected
			// goal (of course, they won't due to terrain and crowding)...
//.........这里部分代码省略.........
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:101,代码来源:group.cpp

示例9: addToRoster

void Team::addToRoster(MoverPtr mover)
{
	if(mover)
		roster[rosterSize++] = mover->getWatchID();
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:5,代码来源:team.cpp


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