コード例 #1
0
ファイル: object.cpp プロジェクト: nox-wizard/noxwizard
/*!
\brief Return the tempfx vector from the object
\author Wintermute
*/
TempfxVector *cObject::getTempfxVec( )
{
	if ( !hasTempfx() )
		return NULL;

	return this->tempfx;
}
コード例 #2
0
ファイル: object.cpp プロジェクト: nox-wizard/noxwizard
/*!
\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 );
}
コード例 #3
0
ファイル: object.cpp プロジェクト: nox-wizard/noxwizard
/*!
\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();
        }
}
コード例 #4
0
ファイル: object.cpp プロジェクト: nox-wizard/noxwizard
/*!
\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;
}
コード例 #5
0
ファイル: object.cpp プロジェクト: nox-wizard/noxwizard
/*!
\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;
	}
}
コード例 #6
0
/*!
\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 );
}