You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The crowbar has id 1 so it's the last weapon to be processed. But if the crowbar, or whichever weapon is in bucket 0, slot 0 has an id greater than that, and if there is an unused id lower than that then it will still process that unused weapon and "drop" the weapon, removing whichever weapon is in bucket 0, slot 0.
This happens because unused weapon slots default to bucket 0, slot 0, so whichever weapon is in that position is removed from the list.
To reproduce this, change the WEAPON_CROWBAR value from 1 to 30. You will no longer see the crowbar in the weapon list.
To fix this the code has to check if the weapon has a valid id:
for (int i = MAX_WEAPONS-1; i > 0; i-- )
{
WEAPON *p = gWR.GetWeapon(i);
if ( p && 0 != p->iId )
{
if ( gHUD.m_iWeaponBits & ( 1 << p->iId ) )
gWR.PickupWeapon( p );
elsegWR.DropWeapon( p );
}
}
This bug is probably why this for loop goes from back to front, and why WEAPON_SUIT is 31 instead of 1.
The text was updated successfully, but these errors were encountered:
The crowbar is not shown in the hud weapon list if there are empty weapon slots with a lower id in the client's weapon list.
The cause of this bug is here:
halflife/cl_dll/ammo.cpp
Lines 355 to 366 in c7240b9
The crowbar has id 1 so it's the last weapon to be processed. But if the crowbar, or whichever weapon is in bucket 0, slot 0 has an id greater than that, and if there is an unused id lower than that then it will still process that unused weapon and "drop" the weapon, removing whichever weapon is in bucket 0, slot 0.
This happens because unused weapon slots default to bucket 0, slot 0, so whichever weapon is in that position is removed from the list.
To reproduce this, change the
WEAPON_CROWBAR
value from1
to30
. You will no longer see the crowbar in the weapon list.To fix this the code has to check if the weapon has a valid id:
This bug is probably why this for loop goes from back to front, and why
WEAPON_SUIT
is31
instead of1
.The text was updated successfully, but these errors were encountered: