]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Error case: Skip reloading and warn if attempting to reload a weapon that does not...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 20:29:46 +0000 (22:29 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 20:29:46 +0000 (22:29 +0200)
qcsrc/server/cl_weaponsystem.qc

index 42128129e0840a4cd8e83ac11a4af62eac86e126..2c8fd6cbd28f507fc413db2537acdfada8151293 100644 (file)
@@ -1722,6 +1722,14 @@ void W_ReloadStart()
 
 void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, string sent_sound)
 {
 
 void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, string sent_sound)
 {
+       entity e;
+       e = get_weaponinfo(self.weapon);
+       if not(e.spawnflags & WEP_FLAG_RELOADABLE) // don't reload weapons that don't have the RELOADABLE flag
+       {
+               dprint("Warning: Attempted to reload a weapon that does not have the WEP_FLAG_RELOADABLE spawnflag. Fix your code!");
+               return;
+       }
+
        self.reload_ammo_min = sent_ammo_min;
        self.reload_ammo_amount = sent_ammo_amount;
        self.reload_time = sent_time;
        self.reload_ammo_min = sent_ammo_min;
        self.reload_ammo_amount = sent_ammo_amount;
        self.reload_time = sent_time;