Weapons_AddItem: Don't assign bitflag to inventory if pickup() returns 0

This commit is contained in:
Marco Cawthorne 2021-03-28 12:16:31 +02:00
parent 075033e93c
commit 9c4487b2e9
1 changed files with 8 additions and 1 deletions

View File

@ -158,11 +158,18 @@ Weapons_AddItem(base_player pl, int w, int startammo)
/* call pickup to handle the ammo */
if (pl.g_items & g_weapons[w].id) {
value = g_weapons[w].pickup(FALSE, startammo);
if (!value)
return value;
} else {
/* new to our arsenal */
pl.g_items |= g_weapons[w].id;
value = g_weapons[w].pickup(TRUE, startammo);
if (!value)
return value;
pl.g_items |= g_weapons[w].id;
/* it's new, so autoswitch? */
if (pl.activeweapon == 0 && autocvar_sv_forceweapondraw == 1) {
pl.activeweapon = w;