Skip to content

Commit 28659bb

Browse files
committed
fix deletion of looping sounds
Per the comment earlier in this function, both -1 and -2 are expected values for sound indexes. Update the sound validity check accordingly. Fixes an assertion in `obj_snd_delete()` encountered by FotG when a sound index was -2.
1 parent a84941e commit 28659bb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

code/ship/ship.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10360,11 +10360,10 @@ void update_firing_sounds(object* objp, ship* shipp)
1036010360
end_snd_played = wip->end_firing_snd;
1036110361
}
1036210362

10363-
if (wip->loop_firing_snd.isValid()) {
10363+
if (swp->firing_loop_sounds[i] >= 0) {
1036410364
obj_snd_delete(objp, swp->firing_loop_sounds[i]);
10365-
swp->firing_loop_sounds[i] = -1;
10366-
} else
10367-
swp->firing_loop_sounds[i] = -1;
10365+
}
10366+
swp->firing_loop_sounds[i] = -1;
1036810367
}
1036910368
}
1037010369
}

0 commit comments

Comments
 (0)