]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use some more WEP_MAXCOUNT and fix checks of WEP_LAST
authorterencehill <piuntn@gmail.com>
Thu, 11 Nov 2010 19:06:10 +0000 (20:06 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 11 Nov 2010 19:06:10 +0000 (20:06 +0100)
qcsrc/common/items.qc
qcsrc/server/bot/havocbot/role_onslaught.qc
qcsrc/server/t_items.qc

index 37ffb25e7c3cff3b49e3581dc69a179048483212..5387c05aae1cac4d2d26d1aae4172536be840326 100644 (file)
@@ -1,5 +1,5 @@
 // WEAPON PLUGIN SYSTEM
-entity weapon_info[24];
+entity weapon_info[WEP_MAXCOUNT];
 entity dummy_weapon_info;
 
 void register_weapon(float id, float(float) func, float ammotype, float i, float weapontype, float pickupbasevalue, string modelname, string shortname, string wname)
@@ -43,7 +43,7 @@ void register_weapons_done()
 
        float i;
        weaponorder_byid = "";
-       for(i = 24; i >= 1; --i)
+       for(i = WEP_MAXCOUNT; i >= 1; --i)
                if(weapon_info[i-1])
                        weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
        weaponorder_byid = strzone(substring(weaponorder_byid, 1, strlen(weaponorder_byid) - 1));
index 3268daefa5a5ae601056dc02a1b6d6142ee3662f..f774cd86474e35a0ce3a4fc2450cc248ff670e26 100644 (file)
@@ -35,7 +35,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
                needarmor = TRUE;
 
        // Needs weapons?
-       for(i = WEP_FIRST; i < WEP_LAST ; ++i)
+       for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
        {
                // Find weapon
                if(power2of(i-1) & self.weapons)
index 9f0075afa53756b1f278443e979f7d37bde3c424..63d0a48b7b71f926de0b4b913baffd3882790a09 100644 (file)
@@ -598,7 +598,7 @@ float weapon_pickupevalfunc(entity player, entity item)
        // If custom weapon priorities for bots is enabled rate most wanted weapons higher
        if( bot_custom_weapon && c )
        {
-               for(i = WEP_FIRST; i < WEP_LAST ; ++i)
+               for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
                {
                        // Find weapon
                        if( (get_weaponinfo(i)).weapons & item.weapons  != item.weapons )
@@ -638,7 +638,7 @@ float commodity_pickupevalfunc(entity player, entity item)
        c = 0;
 
        // Detect needed ammo
-       for(i = WEP_FIRST; i < WEP_LAST ; ++i)
+       for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
        {
                wi = get_weaponinfo(i);