From: terencehill Date: Thu, 11 Nov 2010 19:06:10 +0000 (+0100) Subject: Use some more WEP_MAXCOUNT and fix checks of WEP_LAST X-Git-Tag: xonotic-v0.1.0preview~61^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7b4c329bdd22d51521204c990e9111640996a2bf;p=xonotic%2Fxonotic-data.pk3dir.git Use some more WEP_MAXCOUNT and fix checks of WEP_LAST --- diff --git a/qcsrc/common/items.qc b/qcsrc/common/items.qc index 37ffb25e7..5387c05aa 100644 --- a/qcsrc/common/items.qc +++ b/qcsrc/common/items.qc @@ -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)); diff --git a/qcsrc/server/bot/havocbot/role_onslaught.qc b/qcsrc/server/bot/havocbot/role_onslaught.qc index 3268daefa..f774cd864 100644 --- a/qcsrc/server/bot/havocbot/role_onslaught.qc +++ b/qcsrc/server/bot/havocbot/role_onslaught.qc @@ -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) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 9f0075afa..63d0a48b7 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -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);