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


C++ MoverPtr类代码示例

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


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

示例1: update

void TeamSensorSystem::update (void) {

	if (numSensors > 0) {
#if 0
		//DEBUGGING
		for (long k = 0; k < numContacts; k++) {
			MoverPtr mover = (MoverPtr)ObjectManager->get(contacts[k]);
			Assert(mover->getContactInfo()->teams[teamId] == k, 0, " Bad teams/contact link ");
		}
#endif
		
		if (Team::teams[teamId] == Team::home)
			SoundSystem::largestSensorContact = -1;

		//---------------------------------
		// First, update actual scanning...
		for (long i = 0; i < numSensors; i++)
			sensors[i]->updateScan();

		if (Team::teams[teamId]->rosterSize < NUM_CONTACT_UPDATES_PER_PASS)
			numContactUpdatesPerPass = Team::teams[teamId]->rosterSize;
		else
			numContactUpdatesPerPass = NUM_CONTACT_UPDATES_PER_PASS;

		//--------------------------------
		// Now, update current contacts...
		for (i = 0; i < numContactUpdatesPerPass; i++) {
			if (curContactUpdate >= numSensors)
				curContactUpdate = 0;
			sensors[curContactUpdate]->updateContacts();
			curContactUpdate++;
		}
	}
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:34,代码来源:Contact.cpp

示例2: Assert

bool Team::isCapturing(GameObjectWatchID targetWID, GameObjectWatchID exceptWID)
{
	if(exceptWID)
		for(size_t i = 0; i < rosterSize; i++)
		{
			if(roster[i] == exceptWID)
				continue;
			MoverPtr mover = dynamic_cast<MoverPtr>(ObjectManager->getByWatchID(roster[i]));
			Assert(mover != nullptr, roster[i], " Team.isTargeting: nullptr mover ");
			MechWarriorPtr pilot = mover->getPilot();
			if(pilot && (pilot->getCurTacOrder()->code == TACTICAL_ORDER_CAPTURE))
			{
				GameObjectPtr target = pilot->getCurTacOrder()->getTarget();
				if(target && (target->getWatchID() == targetWID))
					return(true);
			}
		}
	else
		for(size_t i = 0; i < rosterSize; i++)
		{
			MoverPtr mover = dynamic_cast<MoverPtr>(ObjectManager->getByWatchID(roster[i]));
			Assert(mover != nullptr, roster[i], " Team.isTargeting: nullptr mover ");
			MechWarriorPtr pilot = mover->getPilot();
			if(pilot && (pilot->getCurTacOrder()->code == TACTICAL_ORDER_CAPTURE))
			{
				GameObjectPtr target = pilot->getCurTacOrder()->getTarget();
				if(target && (target->getWatchID() == targetWID))
					return(true);
			}
		}
	return(false);
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:32,代码来源:team.cpp

示例3: return

long TeamSensorSystem::getContacts (GameObjectPtr looker, long* contactList, long contactCriteria, long sortType) {

	if ((sortType != CONTACT_SORT_NONE) && !looker)
		return(0);

	static float sortValues[MAX_CONTACTS_PER_SENSOR];

	float CV = 0;
	long numValidContacts = 0;
	long handleList[MAX_CONTACTS_PER_SENSOR];
	for (long i = 0; i < numContacts; i++) {
		MoverPtr mover = (MoverPtr)ObjectManager->get(contacts[i]);
		if (!meetsCriteria(looker, mover, contactCriteria))
			continue;
		handleList[numValidContacts] = mover->getHandle();
		switch (sortType) {
			case CONTACT_SORT_NONE:
				sortValues[numValidContacts] = 0.0;
				break;
			case CONTACT_SORT_CV:
				CV = (float)mover->getCurCV();
				sortValues[numValidContacts] = CV;
				break;
			case CONTACT_SORT_DISTANCE:
				sortValues[numValidContacts] = looker->distanceFrom(mover->getPosition());
				break;
		}
		numValidContacts++;
	}

	if ((numValidContacts > 0) && (sortType != CONTACT_SORT_NONE)) {
		//---------------------------------------------------------
		// BIG ASSUMPTION HERE: That a mech will not have more than
		// MAX_CONTACTS_PER_SENSOR contacts.
		if (!SensorSystem::sortList) {
			SensorSystem::sortList = new SortList;
			if (!SensorSystem::sortList)
				Fatal(0, " Unable to create Contact sortList ");
			SensorSystem::sortList->init(MAX_CONTACTS_PER_SENSOR);
		}
		bool descendSort = true;
		if (sortType == CONTACT_SORT_DISTANCE)
			descendSort = false;
		SensorSystem::sortList->clear(descendSort);
		for (long contact = 0; contact < numValidContacts; contact++) {
			SensorSystem::sortList->setId(contact, handleList[contact]);
			SensorSystem::sortList->setValue(contact, sortValues[contact]);
		}
		SensorSystem::sortList->sort(descendSort);
		for (contact = 0; contact < numValidContacts; contact++)
			contactList[contact] = SensorSystem::sortList->getId(contact);
		}
	else if (contactList)
		for (long contact = 0; contact < numValidContacts; contact++)
			contactList[contact] = handleList[contact];


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

示例4: return

//---------------------------------------------------------------------------
int32_t GameCamera::activate(void)
{
	//------------------------------------------
	// If camera is already active, just return
	if (ready && active)
		return (NO_ERROR);
	//---------------------------------------------------------
	// Camera always starts pointing at first mover in lists
	// CANNOT be infinite because we don't allow missions without at least 1
	// player mech!!
	MoverPtr firstMover = nullptr;
	if (ObjectManager->getNumMovers() > 0)
	{
		int32_t i  = 0;
		firstMover = ObjectManager->getMover(i);
		while (firstMover &&
			((firstMover->getCommander()->getId() != Commander::home->getId()) ||
				!firstMover->isOnGUI()))
		{
			i++;
			if (i == ObjectManager->getNumMovers())
				break;
			firstMover = ObjectManager->getMover(i);
		}
	}
	if (firstMover)
	{
		Stuff::Vector3D newPosition(firstMover->getPosition());
		setPosition(newPosition);
	}
	if (land)
	{
		land->update();
	}
	allNormal();
	// updateDaylight(true);
	lastShadowLightPitch = lightPitch;
	// Startup the SKYBox
	int32_t appearanceType					= (GENERIC_APPR_TYPE << 24);
	AppearanceTypePtr genericAppearanceType = nullptr;
	genericAppearanceType = appearanceTypeList->getAppearance(appearanceType, "skybox");
	if (!genericAppearanceType)
	{
		char msg[1024];
		sprintf(msg, "No Generic Appearance Named %s", "skybox");
		Fatal(0, msg);
	}
	theSky = new GenericAppearance;
	gosASSERT(theSky != nullptr);
	//--------------------------------------------------------------
	gosASSERT(genericAppearanceType->getAppearanceClass() == GENERIC_APPR_TYPE);
	theSky->init((GenericAppearanceType*)genericAppearanceType, nullptr);
	theSky->setSkyNumber(mission->theSkyNumber);
	return NO_ERROR;
}
开发者ID:mechasource,项目名称:mechcommander2,代码行数:56,代码来源:gamecam.cpp

示例5: isContact

bool SensorSystem::isContact (MoverPtr mover) {

	if (mover->getFlag(OBJECT_FLAG_REMOVED))
		return(false);
	if (notShutdown)
		return(mover->getContactInfo()->getSensor(id) < 255);
	for (long i = 0; i < numContacts; i++)
		if ((contacts[i] & 0x7FFF) == mover->getHandle())
			return(true);
	return(false);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:11,代码来源:Contact.cpp

示例6: getVisualContacts

long TeamSensorSystem::getVisualContacts (MoverPtr* moverList) {

	long numVisualContacts = 0;
	for (long i = 0; i < numContacts; i++) {
		MoverPtr contact = (MoverPtr)ObjectManager->get(contacts[i]);
		if (!contact->getFlag(OBJECT_FLAG_REMOVED))
			if (contact->getContactStatus(teamId, true) == CONTACT_VISUAL)
				moverList[numVisualContacts++] = contact;
	}
	return(numVisualContacts);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:11,代码来源:Contact.cpp

示例7: getSensorContacts

long TeamSensorSystem::getSensorContacts (MoverPtr* moverList) {

	static bool isSensor[NUM_CONTACT_STATUSES] = {false, true, true, true, true, false};
	long numSensorContacts = 0;
	for (long i = 0; i < numContacts; i++) {
		MoverPtr contact = (MoverPtr)ObjectManager->get(contacts[i]);
		if (!contact->getFlag(OBJECT_FLAG_REMOVED))
			if (isSensor[contact->getContactStatus(teamId, true)])
				moverList[numSensorContacts++] = contact;
	}
	return(numSensorContacts);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:12,代码来源:Contact.cpp

示例8: hasSensorContact

bool TeamSensorSystem::hasSensorContact (long teamID) {

	for (long i = 0; i < numContacts; i++) {
		MoverPtr mover = (MoverPtr)ObjectManager->get(contacts[i]);
		if (!mover->getFlag(OBJECT_FLAG_REMOVED)) {
			static bool isSensor[NUM_CONTACT_STATUSES] = {false, true, true, true, true, false};
			if (isSensor[mover->getContactStatus(teamID, true)])
				return(true);
		}
	}
	return(false);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:12,代码来源:Contact.cpp

示例9: 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

示例10: modifyContact

void SensorSystem::modifyContact(MoverPtr mover, bool visual)
{
	int32_t contactNum = mover->getContactInfo()->getSensor(id);
	if(contactNum < MAX_CONTACTS_PER_SENSOR)
	{
		if(visual)
			contacts[contactNum] =  mover->getHandle() | 0x8000;
		else
			contacts[contactNum] =  mover->getHandle();
	}
	if(notShutdown)
		master->modifyContact(this, mover, visual ? CONTACT_VISUAL :  getSensorQuality());
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:13,代码来源:contact.cpp

示例11: Fatal

//---------------------------------------------------------------------------
long SensorSystem::scanBattlefield (void) 
{
	//NOW returns size of largest contact!
	long currentLargest = -1;
	
	if (!owner)
		Fatal(0, " Sensor has no owner ");

	if (!master)
		Fatal(0, " Sensor has no master ");

	if ((masterIndex == -1) || (range < 0.0))
		return(0);

	long numNewContacts = 0;

	long numMovers = ObjectManager->getNumMovers();
	for (long i = 0; i < numMovers; i++) 
	{
		MoverPtr mover = (MoverPtr)ObjectManager->getMover(i);
		if (mover->getExists() && (mover->getTeamId() != owner->getTeamId())) 
		{
			long contactStatus = calcContactStatus(mover);
			if (isContact(mover)) 
			{
				if (contactStatus == CONTACT_NONE)
					removeContact(mover);
				else
				{
					modifyContact(mover, contactStatus == CONTACT_VISUAL ? true : false);
					getLargest(currentLargest,mover,contactStatus);
				}
			}
			else 
			{
				if (contactStatus != CONTACT_NONE) 
				{
					addContact(mover, contactStatus == CONTACT_VISUAL ? true : false);
					getLargest(currentLargest,mover,contactStatus);
					numNewContacts++;
				}
			}
		}
	}

	totalContacts += numNewContacts;
	
	return(currentLargest);
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:50,代码来源:Contact.cpp

示例12: getMover

long MoverGroup::disband (void) {

	for (long i = 0; i < numMovers; i++) {
		MoverPtr mover = getMover(i);
		mover->setGroupId(-1, true);
	}
#ifdef USE_IFACE
	if (pointHandle)
		theInterface->setPoint(pointHandle, false);
#endif
	pointWID = 0;
	numMovers = 0;

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

示例13: 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

示例14: getLargest

//---------------------------------------------------------------------------
__inline void getLargest (long &currentLargest, MoverPtr mover, long contactStatus)
{
	long thisMoverSize = -1;
	switch (contactStatus)
	{
		case	CONTACT_SENSOR_QUALITY_1:
		case	CONTACT_SENSOR_QUALITY_2:
			thisMoverSize = 0;
			break;

		case	CONTACT_SENSOR_QUALITY_3:
		case	CONTACT_SENSOR_QUALITY_4:
		case	CONTACT_VISUAL:
			float tonnage = mover->getTonnage();
			if (tonnage < 35.0f)
				thisMoverSize = 1;
			else if (tonnage < 55.0f)
				thisMoverSize = 2;
			else if (tonnage < 75.0f)
				thisMoverSize = 3;
			else
				thisMoverSize = 4;
			break;
	}

	if (thisMoverSize > currentLargest)
		currentLargest = thisMoverSize;
}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:29,代码来源:Contact.cpp

示例15: 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


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