]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #1434
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 25 Dec 2014 10:23:51 +0000 (21:23 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 25 Dec 2014 10:23:51 +0000 (21:23 +1100)
qcsrc/server/weapons/weaponsystem.qc

index 762f9a0e3dc12b619b531128366b6d9f0c36506f..2d8fa6b001824c2ce2c83caa50a3e149ddfc2469 100644 (file)
@@ -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;