int CBaseCombatWeapon::GetAvailableWeaponsInBox( CBaseCombatWeapon **pList, int listMax, const Vector &mins, const Vector &maxs ) { // linear search all weapons int count = 0; int index = g_WeaponList.m_list.Head(); while ( index != g_WeaponList.m_list.InvalidIndex() ) { CBaseCombatWeapon *pWeapon = g_WeaponList.m_list[index]; // skip any held weapon if ( !pWeapon->GetOwner() ) { // restrict to mins/maxs if ( IsPointInBox( pWeapon->GetAbsOrigin(), mins, maxs ) ) { if ( count < listMax ) { pList[count] = pWeapon; count++; } } } index = g_WeaponList.m_list.Next( index ); } return count; }
//----------------------------------------------------------------------------- // Purpose: Only send the LocalWeaponData to the player carrying the weapon //----------------------------------------------------------------------------- void* SendProxy_SendCombatShieldLocalWeaponDataTable( const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID ) { // Get the weapon entity CBaseCombatWeapon *pWeapon = (CBaseCombatWeapon*)pVarData; if ( pWeapon ) { // Only send this chunk of data to the player carrying this weapon CBasePlayer *pPlayer = ToBasePlayer( pWeapon->GetOwner() ); if ( pPlayer ) { pRecipients->SetOnly( pPlayer->GetClientIndex() ); return (void*)pVarData; } } return NULL; }