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

Method _addObject

Engine/source/console/simSet.cpp:621–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619//-----------------------------------------------------------------------------
620
621void 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

Callers

nothing calls this directly

Calls 11

pushBackForceMethod · 0.80
isProperlyAddedMethod · 0.80
errorfFunction · 0.70
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