Fixed sounds array truncate logic in update method

This commit is contained in:
Pavle Goloskokovic 2018-01-05 19:35:44 +01:00
parent 7e223685b3
commit 78c74739fc

View file

@ -201,9 +201,9 @@ var BaseSoundManager = new Class({
this.sounds.sort(function (s1, s2) { this.sounds.sort(function (s1, s2) {
return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1; return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1;
}); });
for (var i = this.sounds.length - 1; i >= 0; i--) { for (var i = 0; i < this.sounds.length; i++) {
if (!this.sounds[i].pendingRemove) { if (this.sounds[i].pendingRemove) {
this.sounds.splice(this.sounds.length - 1 - i); this.sounds.length = i;
break; break;
} }
} }