MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _addObject

Method _addObject

Engine/source/console/simSet.cpp:623–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

errorfFunction · 0.85
pushBackForceMethod · 0.80
isProperlyAddedMethod · 0.80
getGroupMethod · 0.45
incRefCountMethod · 0.45
removeObjectMethod · 0.45
pushBackMethod · 0.45
insertMethod · 0.45
onGroupAddMethod · 0.45
triggerMethod · 0.45
decRefCountMethod · 0.45

Tested by

no test coverage detected