本文整理汇总了C++中Portal::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Portal::getName方法的具体用法?C++ Portal::getName怎么用?C++ Portal::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portal
的用法示例。
在下文中一共展示了Portal::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectPortalsToTargetZonesByLocation
/* Attempt to automatically connect unconnected portals to proper target zones
* by looking for matching portals in other zones which are at the same location
*/
void PCZSceneManager::connectPortalsToTargetZonesByLocation(void)
{
// go through every zone to find portals
ZoneMap::iterator i, iend;
PCZone* zone;
iend = mZones.end();
bool foundMatch;
for (i = mZones.begin(); i != iend; i++)
{
zone = i->second;
// go through all the portals in the zone
Portal* portal;
PortalList::iterator pi, piend;
piend = zone->mPortals.end();
for (pi = zone->mPortals.begin(); pi != piend; pi++)
{
portal = *pi;
//portal->updateDerivedValues();
if (portal->getTargetZone() == 0)
{
// this is a portal without a connected zone - look for
// a matching portal in another zone
PCZone* zone2;
ZoneMap::iterator j= mZones.begin();
foundMatch = false;
while (!foundMatch && j != mZones.end())
{
zone2 = j->second;
if (zone2 != zone) // make sure we don't look in the same zone
{
Portal * portal2 = zone2->findMatchingPortal(portal);
if (portal2)
{
// found a match!
Ogre::LogManager::getSingletonPtr()->logMessage("Connecting portal "+portal->getName()+" to portal "+portal2->getName());
foundMatch = true;
portal->setTargetZone(zone2);
portal->setTargetPortal(portal2);
portal2->setTargetZone(zone);
portal2->setTargetPortal(portal);
}
}
j++;
}
if (foundMatch == false)
{
// error, didn't find a matching portal!
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
"Could not find matching portal for portal " + portal->getName(),
"PCZSceneManager::connectPortalsToTargetZonesByLocation");
}
}
}
}
}
示例2: destroyPortal
// delete a portal instance by pointer
void PCZSceneManager::destroyPortal(const String & portalName)
{
// find the portal from the master portal list
Portal * p;
Portal * thePortal = 0;
PortalList::iterator it = mPortals.begin();
while (it != mPortals.end())
{
p = *it;
if (p->getName() == portalName)
{
thePortal = p;
// erase entry in the master list
mPortals.erase(it);
break;
}
it++;
}
if (thePortal)
{
// remove the portal from it's target portal
Portal * targetPortal = thePortal->getTargetPortal();
if (targetPortal)
{
targetPortal->setTargetPortal(0); // the targetPortal will still have targetZone value, but targetPortal will be invalid
}
// remove the Portal from it's home zone
PCZone * homeZone = thePortal->getCurrentHomeZone();
if (homeZone)
{
// inform zone of portal change
homeZone->setPortalsUpdated(true);
homeZone->_removePortal(thePortal);
}
// delete the portal instance
OGRE_DELETE thePortal;
}
}