From: TimePath Date: Thu, 25 Dec 2014 10:23:51 +0000 (+1100) Subject: Fix #1434 X-Git-Tag: xonotic-v0.8.0~50^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0bb8d5706f4da165c323abeffedefa7971e18148;p=xonotic%2Fxonotic-data.pk3dir.git Fix #1434 --- diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 762f9a0e3..2d8fa6b00 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -691,7 +691,7 @@ void W_WeaponFrame() self.weapon = self.switchweapon; self.weaponname = newwep.mdl; self.bulletcounter = 0; - //self.ammo_field = newwep.ammo_field; + self.ammo_field = newwep.ammo_field; WEP_ACTION(self.switchweapon, WR_SETUP); self.weaponentity.state = WS_RAISE; @@ -864,11 +864,10 @@ void W_ReloadedAndReady() self.clip_load = self.reload_ammo_amount; else { - while(self.clip_load < self.reload_ammo_amount && self.(self.ammo_field)) // make sure we don't add more ammo than we have - { - self.clip_load += 1; - self.(self.ammo_field) -= 1; - } + // make sure we don't add more ammo than we have + float load = min(self.reload_ammo_amount - self.clip_load, self.(self.ammo_field)); + self.clip_load += load; + self.(self.ammo_field) -= load; } self.(weapon_load[self.weapon]) = self.clip_load;