本文整理汇总了C++中MoverPtr::getContactInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ MoverPtr::getContactInfo方法的具体用法?C++ MoverPtr::getContactInfo怎么用?C++ MoverPtr::getContactInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoverPtr
的用法示例。
在下文中一共展示了MoverPtr::getContactInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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++;
}
}
}
示例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);
}
示例3: modifyContact
void TeamSensorSystem::modifyContact(SensorSystemPtr sensor, MoverPtr contact, int32_t contactStatus)
{
ContactInfoPtr contactInfo = contact->getContactInfo();
if(contactInfo->teamSpotter[teamId] == sensor->owner->getHandle())
{
int32_t curStatus = contactInfo->contactStatus[teamId];
if(contactStatus > curStatus)
contactInfo->contactStatus[teamId] = contactStatus;
else if(contactStatus < curStatus)
{
int32_t bestStatus;
SensorSystemPtr bestSensor = findBestSpotter(contact, &bestStatus);
contactInfo->contactStatus[teamId] = bestStatus;
contactInfo->teamSpotter[teamId] = bestSensor->owner->getHandle();
}
}
else
{
int32_t curStatus = contactInfo->contactStatus[teamId];
if(contactStatus > curStatus)
{
contactInfo->contactStatus[teamId] = contactStatus;
contactInfo->teamSpotter[teamId] = sensor->owner->getHandle();
}
}
}
示例4: 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);
}
示例5: removeContact
void TeamSensorSystem::removeContact(SensorSystemPtr sensor, MoverPtr contact)
{
ContactInfoPtr contactInfo = contact->getContactInfo();
contactInfo->sensors[sensor->id] = 255;
contactInfo->contactCount[teamId]--;
Assert(contactInfo->contactCount[teamId] != 255, 0, "FUDGE");
if(contactInfo->contactCount[teamId] == 0)
{
int32_t contactIndex = contactInfo->teams[teamId];
Assert(contactIndex < 0xFFFF, contactIndex, " 0xFFFF ");
MoverPtr removedContact = (MoverPtr)ObjectManager->get(contacts[contactIndex]);
Assert(removedContact == contact, contactIndex, " TeamSensorSystem.removeContact: bad contact ");
contactInfo->teams[teamId] = 0xFFFF;
contactInfo->contactStatus[teamId] = CONTACT_NONE;
contactInfo->teamSpotter[teamId] = 0;
numContacts--;
if((numContacts > 0) && (contactIndex != numContacts))
{
//-----------------------------------------------
// Fill vacated slot with contact in last slot...
contacts[contactIndex] = contacts[numContacts];
MoverPtr mover = (MoverPtr)ObjectManager->get(contacts[numContacts]);
mover->getContactInfo()->teams[teamId] = contactIndex;
}
}
else if(contactInfo->teamSpotter[teamId] == sensor->owner->getHandle())
{
if(sensor->owner->getObjectClass() == BATTLEMECH)
Assert(sensor != nullptr, 0, " dumb ");
int32_t bestStatus;
SensorSystemPtr bestSensor = findBestSpotter(contact, &bestStatus);
// Assert(bestSensor != nullptr, 0, " hit ");
if(bestSensor)
{
contact->contactInfo->contactStatus[teamId] = bestStatus;
contact->contactInfo->teamSpotter[teamId] = bestSensor->owner->getHandle();
}
}
}
示例6: addContact
void TeamSensorSystem::addContact (SensorSystemPtr sensor, MoverPtr contact, long contactIndex, long contactStatus) {
Assert(numContacts < MAX_CONTACTS_PER_TEAM, numContacts, " TeamSensorSystem.addContact: max team contacts ");
ContactInfoPtr contactInfo = contact->getContactInfo();
contactInfo->sensors[sensor->id] = contactIndex;
contactInfo->contactCount[teamId]++;
if (contactInfo->contactStatus[teamId] < contactStatus) {
contactInfo->contactStatus[teamId] = contactStatus;
contactInfo->teamSpotter[teamId] = sensor->owner->getHandle();
}
if (contactInfo->contactCount[teamId] == 1) {
contacts[numContacts] = contact->getHandle();
contactInfo->teams[teamId] = numContacts;
numContacts++;
sensor->numExclusives++;
}
}
示例7: getContactStatus
long TeamSensorSystem::getContactStatus (MoverPtr mover, bool includingAllies) {
if (mover->getFlag(OBJECT_FLAG_REMOVED))
return(CONTACT_NONE);
return(mover->getContactInfo()->getContactStatus(Team::teams[teamId]->getId(), true));
}
示例8: removeContact
void SensorSystem::removeContact (MoverPtr contact) {
long contactIndex = contact->getContactInfo()->getSensor(id);
if (contactIndex < 255)
removeContact(contactIndex);
}