/** Delete a anti portal instance by name */ void PCZSceneManager::destroyAntiPortal(const String& portalName) { // find the anti portal from the master portal list AntiPortal* p; AntiPortal* thePortal = 0; AntiPortalList::iterator it = mAntiPortals.begin(); while (it != mAntiPortals.end()) { p = *it; if (p->getName() == portalName) { thePortal = p; // erase entry in the master list mAntiPortals.erase(it); break; } it++; } if (thePortal) { // remove the Portal from it's home zone PCZone* homeZone = thePortal->getCurrentHomeZone(); if (homeZone) { // inform zone of portal change homeZone->setPortalsUpdated(true); homeZone->_removeAntiPortal(thePortal); } // delete the portal instance OGRE_DELETE thePortal; } }
// delete a portal instance by pointer void PCZSceneManager::destroyPortal(Portal * p) { // remove the portal from it's target portal Portal * targetPortal = p->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 = p->getCurrentHomeZone(); if (homeZone) { // inform zone of portal change. Do here since PCZone is abstract homeZone->setPortalsUpdated(true); homeZone->_removePortal(p); } // remove the portal from the master portal list PortalList::iterator it = std::find( mPortals.begin(), mPortals.end(), p ); if (it != mPortals.end()) { mPortals.erase(it); } // delete the portal instance OGRE_DELETE p; }
/** Delete a anti portal instance by pointer */ void PCZSceneManager::destroyAntiPortal(AntiPortal * p) { // remove the Portal from it's home zone PCZone* homeZone = p->getCurrentHomeZone(); if (homeZone) { // inform zone of portal change. Do here since PCZone is abstract homeZone->setPortalsUpdated(true); homeZone->_removeAntiPortal(p); } // remove the portal from the master portal list AntiPortalList::iterator it = std::find(mAntiPortals.begin(), mAntiPortals.end(), p); if (it != mAntiPortals.end()) mAntiPortals.erase(it); // delete the portal instance OGRE_DELETE p; }
// 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; } }