From f7414915da8b51159953f59ff9e7ea21b9819fe8 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Sun, 21 Jul 2019 23:33:37 -0400 Subject: [PATCH] Readability improvement in really long 'if' statement. --- qcsrc/common/weapons/weapon/machinegun.qc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 132f1c480..e87a885b8 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -199,10 +199,14 @@ METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponenti } METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(WEP_CVAR(machinegun, reload_ammo) && actor.(weaponentity).clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)) && actor.(weaponentity).misc_bulletcounter >= 0) { // forced reload - wait until the bulletcounter is 0 so a burst loop can finish + // forced reload - wait until the bulletcounter is 0 so a burst loop can finish + if(WEP_CVAR(machinegun, reload_ammo) + && actor.(weaponentity).clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)) + && actor.(weaponentity).misc_bulletcounter >= 0) + { thiswep.wr_reload(thiswep, actor, weaponentity); - } else - if(WEP_CVAR(machinegun, mode) == 1) + } + else if(WEP_CVAR(machinegun, mode) == 1) { if(fire & 1) if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0)) -- 2.39.2