From: Mircea Kitsune Date: Fri, 21 Jan 2011 16:11:19 +0000 (+0200) Subject: Make sure we can / need to reload before checking if we have enough ammo to X-Git-Tag: xonotic-v0.5.0~309^2~7^2~156 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5336f983a975713e00a3d3d91a870573b422592c;p=xonotic%2Fxonotic-data.pk3dir.git Make sure we can / need to reload before checking if we have enough ammo to --- diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 1babd2108..faf18b8da 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -1632,6 +1632,11 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) float W_ReloadCheck(float ammo_amount) { + entity e; + e = get_weaponinfo(self.weapon); + if (self.ammo_counter >= cvar(strcat("g_balance_", e.netname, "_reload_ammo"))) + return 0; + if(!ammo_amount) // when we get here, ammo_counter must be 0 or -1 { print("cannot reload... not enough ammo\n"); @@ -1640,11 +1645,6 @@ float W_ReloadCheck(float ammo_amount) return 0; } - entity e; - e = get_weaponinfo(self.weapon); - if (self.ammo_counter >= cvar(strcat("g_balance_", e.netname, "_reload_ammo"))) - return 0; - if (self.weaponentity) { if (self.weaponentity.wframe == WFRAME_RELOAD)