virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
	{
		int iDamageBits = event->GetInt( "damagebits" );
		// only interested blast damage.  (Barrels or other explosive phys objects are all OK)
		if ( !( iDamageBits & DMG_BLAST ) )
			return;

		if ( m_pLastInflictor != NULL && pInflictor != m_pLastInflictor )
		{
			m_iBarnacleCount = 1;
		}
		else
		{
			m_iBarnacleCount++;
			if ( 5 == m_iBarnacleCount )
			{
				IncrementCount();
			}			
		}
		m_pLastInflictor = pInflictor;
	}
	virtual void FireGameEvent_Internal( IGameEvent *event )
	{
		CBasePlayer *pPlayer = CBasePlayer::GetLocalPlayer();
		if ( !pPlayer )
			return;

		// Ignore suicide
		if ( event->GetInt("attacker") == event->GetInt("userid") )
			return;

		// Only care about our attacks (ignore blast damage)
		if ( event->GetInt("attacker") == pPlayer->GetUserID() && event->GetInt("dmgtype") != DMG_BLAST )
		{
			// Check if we have a new victim or we timed out
			if ( gpGlobals->curtime > m_flTimeout || m_nVictim != event->GetInt("userid") )
			{
				// This is a NEW victim
				m_nVictim = event->GetInt("userid");
				m_iTotHits = m_iLegHits = 0;
			}

			m_flTimeout = gpGlobals->curtime + ACH_BREAKLEG_TIMEOUT;

			// Check our hit group
			m_iTotHits++;
			if ( event->GetInt("hitgroup") == HITGROUP_LEFTLEG || event->GetInt("hitgroup") == HITGROUP_RIGHTLEG )
				m_iLegHits++;

			// Check for a death and award if we kept with all leg hits
			if ( event->GetInt("health") <= 0 )
			{
				float ratio = (float)m_iLegHits / (float)m_iTotHits;
				if ( m_iTotHits > 1 && ratio > ACH_BREAKLEG_RATIO )
					IncrementCount();

				m_nVictim = INVALID_ID;
				m_iTotHits = m_iLegHits = 0;
			}
		}
	}
	void FireGameEvent_Internal( IGameEvent *event )
	{
		if ( 0 == Q_strcmp( event->GetName(), "physgun_pickup" ) )
		{
			// was the object picked up a frag grenade?
			CBaseEntity *pEntityPickedUp = UTIL_EntityByIndex( event->GetInt( "entindex" ) );
			if ( pEntityPickedUp && pEntityPickedUp->ClassMatches( "npc_grenade_frag" ) )
			{
				// get the grenade object
				CBaseGrenade *pGrenade = dynamic_cast<CBaseGrenade *>( pEntityPickedUp );
				if ( pGrenade )
				{
					// was the original thrower a zombine?
					CBaseEntity *pOriginalThrower = pGrenade->GetOriginalThrower();
					if ( pOriginalThrower && pOriginalThrower->ClassMatches( "npc_zombine" ) )
					{
						IncrementCount();
					}
				}
			}
		}
	}
	virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
	{
		if ( GEMPRules()->IsIntermission() )
			IncrementCount();
	}
	virtual void FireGameEvent_Internal( IGameEvent *event )
	{
		CBasePlayer *pPlayer = CBasePlayer::GetLocalPlayer();
		if ( !pPlayer )
			return;

		// This message must be about a Klobb and we have to have an active weapon
		if ( !pPlayer->GetActiveWeapon() || event->GetInt("weaponid") != WEAPON_KLOBB )
			return;

		int localid = pPlayer->GetUserID();

		// We must be holding the Klobb
		if ( ToGEWeapon(pPlayer->GetActiveWeapon())->GetWeaponID() == WEAPON_KLOBB )
		{
			if ( !Q_stricmp(event->GetName(), "player_hurt") )
			{
				// Reset our parameters if we timed out
				if ( gpGlobals->curtime > (m_flLastKlobbTime + ACH_TWOKLOBBS_TIMEOUT) )
				{
					m_nVictim = m_nHelper = INVALID_ID;
					m_bInAssist = false;
				}

				// We have filtered out all non-klobb attacks and we must be holding the klobb
				// get the information from the event
				int attacker = event->GetInt("attacker");
				int victim = event->GetInt("userid");

				// Set our current victim
				if ( attacker == localid )
				{
					m_nVictim = victim;
					m_flLastKlobbTime = gpGlobals->curtime;
				}
				else if ( m_nHelper == INVALID_ID && m_nVictim == victim )
				{
					// If another person is attacker our current victim they must be helping us
					m_nHelper = attacker;
				}

				// If this is an attack on our victim and we have a helper and either myself or they are attacking we 
				// are in an assist scenario
				if ( m_nHelper != INVALID_ID && (attacker == localid || attacker == m_nHelper) && m_nVictim == victim )
					m_bInAssist = true;
				else if ( attacker == localid || attacker == m_nHelper )
					m_bInAssist = false;
			}
			else if ( !Q_stricmp(event->GetName(), "player_death") )
			{
				if ( gpGlobals->curtime > (m_flLastKlobbTime + ACH_TWOKLOBBS_TIMEOUT) )
					return;

				// We must be in a assisting a fellow klobber and be attacking the same victim
				if ( m_bInAssist && event->GetInt("userid") == m_nVictim )
				{
					m_flLastKlobbTime = 0;
					m_nHelper = m_nVictim = INVALID_ID;
					m_bInAssist = false;

					IncrementCount();
				}
			}
		}
		else
		{
			m_flLastKlobbTime = 0;
			m_nHelper = m_nVictim = INVALID_ID;
			m_bInAssist = false;
		}
	}
	virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
	{
		if ( event->GetBool("headshot")  )
			IncrementCount();
	}
	virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
	{
		if ( !pAttacker ) return;
		if ( pAttacker->GetHealth() <= 32  )
			IncrementCount();
	}
/****************************************************************
* Enqueue
* ------------------------------------------------------------------------
* This method will allow the user to add a node to the queue. The list
* will be limited to the size set in the constructor. If the user reaches
* the limit, the Enqueue method will output an error message.
**************************************************************************/
void CustomerList::Enqueue(Customer data)
{
	//D E C L A R A T I O N S
	//	Node<typeName> * temp;
	//D E C L A R A T I O N S
	Node<Customer>*  _createNew;   //CALC - used to create dynamic memory

	//D E C L A R A T I O N S
	bool continueTraverse;
	Node<Customer>* _cursor;


	//Begin If only if the list is empty
	if(isEmpty())
	{
		//Creates new dynamic memory
		_createNew  = new Node<Customer>;

		//Sets the data of the newly created node
		_createNew->SetData(data);


		//Creates a new Object and stores data within it
		//Assigns _head and _tail to the new object created in dynamic memory
		_head = _createNew;
		_tail = _createNew;

		//increments the _listCount

		_createNew = NULL;  /* ADDED BY AUSTIN */

		IncrementCount();
	}
	else if(_nodeCount < _listLimit)
	{

		//I N I T I A L I Z A T I O N S
		_cursor          = _head;
		continueTraverse = true;
		//Creates new dynamic memory
		_createNew  = new Node<Customer>;

		//Sets the data of the newly created node
		_createNew->SetData(data);
		//This "if-statement" is designed to add a node when there is only ONE node currently in the list
		// *
		if(_cursor->GetNext() == NULL)
		{

			if(_createNew->GetData().getUserName().toUpper() < _cursor->GetData().getUserName().toUpper())
			{
				_createNew->SetNext(_cursor);

				_cursor->SetPrevious(_createNew); /* ADDED BY AUSTIN */

				_head = _createNew;
			}
			else
			{

				_createNew->SetPrevious(_cursor);
				_cursor->SetNext(_createNew);
				_tail = _createNew;
			}

			_createNew = NULL; /* ADDED BY AUSTIN */

		}
		else // if _cursor->GetNext() != NULL
		{

			_cursor = _cursor->GetNext();

			//This loop is designed to traverse the current list and stop at a place to ensure
			//the node is added to the list according to alphabetical order
			while(_cursor != NULL && continueTraverse)
			{
				if((_createNew->GetData().getUserName().toUpper() < _cursor->GetData().getUserName().toUpper()))
				{
					continueTraverse = false;
					_createNew->SetNext(_cursor);
					_createNew->SetPrevious(_cursor->GetPrevious());
					_cursor-> SetPrevious(_createNew);
					_createNew->GetPrevious()->SetNext(_createNew);
				}
				else
				{
					_cursor = _cursor->GetNext();
				}
			}

			if(continueTraverse)
			{
				_createNew->SetPrevious(_tail);
				_tail->SetNext(_createNew);
				_tail = _createNew;
			}
		}
		//Increments the current Count
		IncrementCount();
	}
	else
	{
		//Outputs error message
		QMessageBox messageBox;
		messageBox.critical(0,"Error","**List has reached its max size**");
		messageBox.setFixedSize(500,200);
	}

}
Esempio n. 9
0
 void GenAppInternalWarning(const char* warnMsg)
 {
     IncrementCount();
     GenAppWarningMsg("Internal", warnMsg);
 //  ASSERT(false);
 }