From: David Knapp Date: Mon, 22 Jul 2019 03:33:37 +0000 (-0400) Subject: Readability improvement in really long 'if' statement. X-Git-Tag: xonotic-v0.8.5~1287^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f7414915da8b51159953f59ff9e7ea21b9819fe8;p=xonotic%2Fxonotic-data.pk3dir.git Readability improvement in really long 'if' statement. --- 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))