Skip to content

Commit

Permalink
fix deletion of looping sounds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Goober5000 committed Aug 27, 2024
1 parent a84941e commit 28659bb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10360,11 +10360,10 @@ void update_firing_sounds(object* objp, ship* shipp)
end_snd_played = wip->end_firing_snd;
}

if (wip->loop_firing_snd.isValid()) {
if (swp->firing_loop_sounds[i] >= 0) {
obj_snd_delete(objp, swp->firing_loop_sounds[i]);
swp->firing_loop_sounds[i] = -1;
} else
swp->firing_loop_sounds[i] = -1;
}
swp->firing_loop_sounds[i] = -1;
}
}
}
Expand Down

0 comments on commit 28659bb

Please sign in to comment.