Skip to content

Commit 7c2bd98

Browse files
Simplified logic for removal of destroyed sounds
1 parent efbf276 commit 7c2bd98

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

v3/src/sound/BaseSoundManager.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,9 @@ var BaseSoundManager = new Class({
198198
* @param {number} delta - The delta time elapsed since the last frame.
199199
*/
200200
update: function (time, delta) {
201-
this.sounds.sort(function (s1, s2) {
202-
return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1;
203-
});
204-
for (var i = 0; i < this.sounds.length; i++) {
201+
for (var i = this.sounds.length - 1; i >= 0; i--) {
205202
if (this.sounds[i].pendingRemove) {
206-
this.sounds.length = i;
207-
break;
203+
this.sounds.splice(i, 1);
208204
}
209205
}
210206
this.sounds.forEach(function (sound) {

0 commit comments

Comments
 (0)