]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Skip complain if: We don't own it, it's not normal, and it's not on the map
authorSamual Lenks <samual@xonotic.org>
Tue, 10 Dec 2013 22:53:42 +0000 (17:53 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 10 Dec 2013 22:53:42 +0000 (17:53 -0500)
qcsrc/server/weapons/selection.qc

index 5b43cc5ab3fee8e6922c66c4662d28d9344efd14..d26ed831fbf05b7e4b427c6833705e97c80814b9 100644 (file)
@@ -118,6 +118,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        switchtonext = switchtolast = 0;
        first_valid = prev_valid = 0;
        float weaponcur;
+       entity wep;
 
        if(skipmissing || pl.selectweapon == 0)
                weaponcur = pl.switchweapon;
@@ -133,10 +134,17 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        while(rest != "")
        {
                weaponwant = stof(car(rest)); rest = cdr(rest);
+               wep = get_weaponinfo(weaponwant);
                if(imp >= 0)
-                       if((get_weaponinfo(weaponwant)).impulse != imp)
+                       if(wep.impulse != imp)
                                continue;
 
+               // skip weapons we don't own that aren't normal and aren't in the map
+               if(!(pl.weapons & WepSet_FromWeapon(weaponwant)))
+                       if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL))
+                               if(!(weaponsInMap & WepSet_FromWeapon(weaponwant)))
+                                       continue;
+
                ++c;
 
                if(!skipmissing || client_hasweapon(pl, weaponwant, TRUE, FALSE))
@@ -173,10 +181,17 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                while(rest != "")
                {
                        weaponwant = stof(car(rest)); rest = cdr(rest);
+                       wep = get_weaponinfo(weaponwant);
                        if(imp >= 0)
-                               if((get_weaponinfo(weaponwant)).impulse != imp)
+                               if(wep.impulse != imp)
                                        continue;
 
+                       // skip weapons we don't own that aren't normal and aren't in the map
+                       if(!(pl.weapons & WepSet_FromWeapon(weaponwant)))
+                               if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL))
+                                       if(!(weaponsInMap & WepSet_FromWeapon(weaponwant)))
+                                               continue;
+
                        --c;
                        if(c == 0)
                        {