From 3e7c8adc1e2c6dd3aa71f437643357a1aef45725 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 26 Oct 2020 07:10:45 +0100 Subject: [PATCH] - checkhitswitch_r part 4 --- source/games/duke/src/sectors_r.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 2a8107cc1..5fe741189 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -552,19 +552,18 @@ bool checkhitswitch_r(int snum, int w, int switchtype) if (si->picnum == DIPSWITCH3) if (si->hitag == 999) { - int j; - StatIterator it1(107); - while ((j = it1.NextIndex()) >= 0) + DukeStatIterator it1(107); + while (auto other2 = it1.Next()) { - if (sprite[j].picnum == RRTILE3410) + if (other2->s.picnum == RRTILE3410) { - sprite[j].picnum++; - sprite[j].hitag = 100; - sprite[j].extra = 0; - S_PlayActorSound(474, j); + other2->s.picnum++; + other2->s.hitag = 100; + other2->s.extra = 0; + S_PlayActorSound(474, other2); } - else if (sprite[j].picnum == RRTILE295) - deletesprite(j); + else if (other2->s.picnum == RRTILE295) + deletesprite(other2); } si->picnum++; break;