| 619 | //----------------------------------------------------------------------------- |
| 620 | |
| 621 | void SimGroup::_addObject( SimObject* obj, bool forcePushBack ) |
| 622 | { |
| 623 | // Make sure we aren't adding ourself. This isn't the most robust check |
| 624 | // but it should be good enough to prevent some self-foot-shooting. |
| 625 | if( obj == this ) |
| 626 | { |
| 627 | Con::errorf( "SimGroup::addObject - (%d) can't add self!", getIdString() ); |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | if( obj->getGroup() == this ) |
| 632 | return; |
| 633 | |
| 634 | lock(); |
| 635 | |
| 636 | obj->incRefCount(); |
| 637 | |
| 638 | if( obj->getGroup() ) |
| 639 | obj->getGroup()->removeObject( obj ); |
| 640 | |
| 641 | if( forcePushBack ? mObjectList.pushBack( obj ) : mObjectList.pushBackForce( obj ) ) |
| 642 | { |
| 643 | mNameDictionary.insert( obj ); |
| 644 | obj->mGroup = this; |
| 645 | |
| 646 | obj->onGroupAdd(); |
| 647 | |
| 648 | getSetModificationSignal().trigger( SetObjectAdded, this, obj ); |
| 649 | if( obj->isProperlyAdded() ) |
| 650 | onObjectAdded_callback( obj ); |
| 651 | } |
| 652 | else |
| 653 | obj->decRefCount(); |
| 654 | |
| 655 | unlock(); |
| 656 | |
| 657 | // SimObjects will automatically remove them from their group |
| 658 | // when deleted so we don't hook up a delete notification. |
| 659 | } |
| 660 | |
| 661 | //----------------------------------------------------------------------------- |
| 662 |
nothing calls this directly
no test coverage detected