File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,17 +87,14 @@ Phaser.LinkedList.prototype = {
8787 * @param {object } child - Description.
8888 */
8989 remove : function ( child ) {
90- if ( this . first ) {
91- child . next = this . last . next ;
92- child . prev = this . last ;
93- if ( this . last . next ) {
94- this . last . next . prev = child ;
95- }
96- this . last . next = child ;
97- this . last = this . last . next ;
98- } else {
99- this . first = this . last = child ;
100- }
90+ if ( child == this . first ) this . first = this . first . next ; // It was 'first', make 'first' point to first.next
91+ else if ( child == this . last ) this . last = this . last . prev ; // It was 'last', make 'last' point to last.prev
92+
93+ if ( child . prev ) child . prev . next = child . next ; // make child.prev.next point to childs.next instead of child
94+ if ( child . next ) child . next . prev = child . prev ; // make child.next.prev point to child.prev instead of child
95+ child . next = child . prev = null ;
96+
97+ if ( this . first == null ) this . last = null ;
10198
10299 this . total -- ;
103100 } ,
You can’t perform that action at this time.
0 commit comments