/*! \brief Return the tempfx vector from the object \author Wintermute */ TempfxVector *cObject::getTempfxVec( ) { if ( !hasTempfx() ) return NULL; return this->tempfx; }
/*! \author Luxor \brief Deletes every tempfx of the specified number */ void cObject::delTempfx( SI32 num, LOGICAL executeExpireCode, SERIAL funcidx ) { if ( num < 0 || num >= tempfx::MAX_TEMPFX_INDEX ) return; if ( !hasTempfx() ) return; TempfxVector::iterator it( tempfx->begin() ); for ( ; it != tempfx->end(); ) { if( ( it->getNum() != num ) || ( it->getAmxCallback() != funcidx ) ) { it++; continue; } if ( executeExpireCode ) it->executeExpireCode(); it = tempfx->erase( it ); } // error: cannot bind packed field ‘((cObject*)this)->cObject::tempfx’ to ‘__gnu_cxx::slist<tempfx::cTempfx>*&’ // safedelete( tempfx ); // if ( tempfx->empty() ) // safedelete( tempfx ); }
/*! \brief Deactivates the temp effects \author Luxor */ void cObject::tempfxOff() { if ( !hasTempfx() ) return; TempfxVector::iterator it( tempfx->begin() ); for ( ; it != tempfx->end(); it++ ) { (*it).deactivate(); } }
/*! \brief Get the tempfx from given num and funcidx \author Luxor */ tempfx::cTempfx* cObject::getTempfx( SI32 num, SERIAL funcidx ) { if ( num < 0 || num >= tempfx::MAX_TEMPFX_INDEX ) return NULL; if ( !hasTempfx() ) return NULL; TempfxVector::iterator it( tempfx->begin() ); for( ; it != tempfx->end(); it++ ) { if( ( it->getNum() == num ) && ( it->getAmxCallback() == funcidx ) ) return &(*it); } return NULL; }
/*! \author Luxor */ void cObject::checkTempfx() { if ( !hasTempfx() ) return; TempfxVector::iterator it( tempfx->begin() ); for ( ; it != tempfx->end(); ) { SI08 result = it->checkForExpire(); if ( result == 1 ) { // Tempfx has been executed it = tempfx->erase( it ); continue; } else if ( result == INVALID ) // Tempfx has deleted the object!! Avoid Crashing! return; ++it; } }
/*! \author Luxor \brief Deletes every tempfx of the specified number */ void cObject::delTempfx( int32_t num, bool executeExpireCode, uint32_t funcidx ) { if ( num < 0 || num >= tempfx::MAX_TEMPFX_INDEX ) return; if ( !hasTempfx() ) return; TempfxVector::iterator it( tempfx->begin() ); for ( ; it != tempfx->end(); ) { if( ( it->getNum() != num ) || ( it->getAmxCallback() != funcidx ) ) { it++; continue; } if ( executeExpireCode ) it->executeExpireCode(); it = tempfx->erase( it ); } if ( tempfx->empty() ) safedelete( tempfx ); }