From 98d5a2686e20de9d8c4b8d8eeb0a231b97d11042 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 Dec 2022 22:20:03 +0100 Subject: [PATCH] - use for loop instead of repeating the same line 10x. --- source/games/duke/src/player_r.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 6d84feb33..f47a9858d 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2638,16 +2638,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->kickback_pic == 4) { - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); + for (int ii = 0; ii < 10; ii++) + fi.shoot(pact, RTILE_SHOTGUN, nullptr); p->ammo_amount[SHOTGUN_WEAPON]--; @@ -2664,16 +2656,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) { if (p->shotgun_state[1]) { - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); - fi.shoot(pact, RTILE_SHOTGUN, nullptr); + for (int ii = 0; ii < 10; ii++) + fi.shoot(pact, RTILE_SHOTGUN, nullptr); p->ammo_amount[SHOTGUN_WEAPON]--;