From: terencehill Date: Wed, 28 Dec 2016 18:11:42 +0000 (+0100) Subject: Small cleanup X-Git-Tag: xonotic-v0.8.2~343^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=18742c2179ab059d829d42879f563412e6df00fb;p=xonotic%2Fxonotic-data.pk3dir.git Small cleanup --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 4f6cf459e..ebab941c0 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -926,7 +926,7 @@ float weapon_pickupevalfunc(entity player, entity item) float c; // See if I have it already - if(!(item.weapons & ~player.weapons)) + if(player.weapons & item.weapons) { // If I can pick it up if(!item.spawnshieldtime) @@ -942,8 +942,11 @@ float weapon_pickupevalfunc(entity player, entity item) else c = 1; + if (c <= 0) + return 0; + // If custom weapon priorities for bots is enabled rate most wanted weapons higher - if( bot_custom_weapon && c ) + if(bot_custom_weapon) { int best_ratio = 0; int missing = 0; @@ -990,9 +993,8 @@ float weapon_pickupevalfunc(entity player, entity item) float commodity_pickupevalfunc(entity player, entity item) { - float c; - float need_shells = false, need_nails = false, need_rockets = false, need_cells = false, need_plasma = false, need_fuel = false; - c = 0; + bool need_shells = false, need_nails = false, need_rockets = false, need_cells = false, need_plasma = false, need_fuel = false; + float c = 0; // Detect needed ammo FOREACH(Weapons, it != WEP_Null, {