]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Small cleanup
authorterencehill <piuntn@gmail.com>
Wed, 28 Dec 2016 18:11:42 +0000 (19:11 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 28 Dec 2016 18:11:42 +0000 (19:11 +0100)
qcsrc/common/t_items.qc

index 4f6cf459ebc203d20ded5c825e3760b6152d254f..ebab941c02d0c1b42a2f9a62dde65fc9f1d94df6 100644 (file)
@@ -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, {