本文整理汇总了C++中C_BaseCombatWeapon::GetBucketPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseCombatWeapon::GetBucketPosition方法的具体用法?C++ C_BaseCombatWeapon::GetBucketPosition怎么用?C++ C_BaseCombatWeapon::GetBucketPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseCombatWeapon
的用法示例。
在下文中一共展示了C_BaseCombatWeapon::GetBucketPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_BaseCombatWeapon *CBaseHudWeaponSelection::GetNextActivePos( int iSlot, int iSlotPos )
{
if ( iSlotPos >= MAX_WEAPON_POSITIONS || iSlot >= MAX_WEAPON_SLOTS )
return NULL;
int iLowestPosition = MAX_WEAPON_POSITIONS;
C_BaseCombatWeapon *pNextWeapon = NULL;
C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
if ( !player )
return NULL;
for ( int i = 0; i < MAX_WEAPONS; i++ )
{
C_BaseCombatWeapon *pWeapon = player->GetWeapon( i );
if ( !pWeapon )
continue;
if ( CanBeSelectedInHUD( pWeapon ) && pWeapon->GetSlot() == iSlot )
{
// If this weapon is lower in the slot than the current lowest, and above our desired position, it's our new winner
if (pWeapon->GetBucketPosition() <= iLowestPosition && pWeapon->GetBucketPosition() >= iSlotPos)
{
iLowestPosition = pWeapon->GetBucketPosition();
pNextWeapon = pWeapon;
}
}
}
return pNextWeapon;
}