| 664 | } |
| 665 | |
| 666 | void Node::childAddAt( Node* node, Uint32 index ) { |
| 667 | eeASSERT( NULL != node ); |
| 668 | |
| 669 | node->setParent( this ); |
| 670 | childRemove( node ); |
| 671 | node->mParentNode = this; |
| 672 | node->mSceneNode = node->findSceneNode(); |
| 673 | |
| 674 | Node* nodeLoop = mChild; |
| 675 | |
| 676 | if ( nodeLoop == NULL ) { |
| 677 | mChild = node; |
| 678 | mChildLast = node; |
| 679 | node->mNext = NULL; |
| 680 | node->mPrev = NULL; |
| 681 | } else { |
| 682 | if ( index == 0 ) { |
| 683 | if ( NULL != mChild ) |
| 684 | mChild->mPrev = node; |
| 685 | |
| 686 | node->mNext = mChild; |
| 687 | node->mPrev = NULL; |
| 688 | mChild = node; |
| 689 | |
| 690 | if ( mChild->mNext == NULL ) |
| 691 | mChildLast = mChild; |
| 692 | } else { |
| 693 | Uint32 i = 0; |
| 694 | |
| 695 | while ( NULL != nodeLoop->mNext && ++i < index ) { |
| 696 | nodeLoop = nodeLoop->mNext; |
| 697 | } |
| 698 | |
| 699 | Node* ChildTmp = nodeLoop->mNext; |
| 700 | nodeLoop->mNext = node; |
| 701 | node->mPrev = nodeLoop; |
| 702 | node->mNext = ChildTmp; |
| 703 | |
| 704 | if ( NULL != ChildTmp ) { |
| 705 | ChildTmp->mPrev = node; |
| 706 | } else { |
| 707 | mChildLast = node; |
| 708 | } |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | eeASSERT( !( NULL == mChildLast && NULL != mChild ) ); |
| 713 | |
| 714 | onChildCountChange( node, false ); |
| 715 | } |
| 716 | |
| 717 | void Node::childRemove( Node* node ) { |
| 718 | if ( node == mChild ) { |
no test coverage detected