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

Method _setPersistentID

Engine/source/console/simObject.cpp:583–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581//-----------------------------------------------------------------------------
582
583bool SimObject::_setPersistentID( void* object, const char* index, const char* data )
584{
585 SimObject* simObject = reinterpret_cast< SimObject* >( object );
586
587 // Make sure we don't already have a PID.
588 if( simObject->getPersistentId() )
589 {
590 Con::errorf( "SimObject::_setPersistentID - cannot set a persistent ID on an object that already has a persistent ID assigned." );
591 return false;
592 }
593
594 SimPersistID* pid;
595 Con::setData( TypePID, &pid, 0, 1, &data );
596 if ( !pid )
597 return false;
598
599 // Make sure it's not already bound to an object.
600 if( pid->getObject() )
601 {
602 AssertWarn( pid->getObject() != simObject, "Sim::_setPersistentID - PID is bound to this object yet not assigned to it!" );
603
604 SimObject* otherObj = pid->getObject();
605 Con::errorf( "SimObject::_setPersistentID - UUID is already used by another object: '%s' -> %i:%s (%s)",
606 data, otherObj->getId(), otherObj->getClassName(), otherObj->getName() );
607
608 return false;
609 }
610
611 pid->resolve( simObject );
612 pid->incRefCount();
613 simObject->mPersistentId = pid;
614
615 return false;
616}
617
618//-----------------------------------------------------------------------------
619

Callers

nothing calls this directly

Calls 9

setDataFunction · 0.85
getPersistentIdMethod · 0.80
errorfFunction · 0.70
getIdMethod · 0.65
getObjectMethod · 0.45
getClassNameMethod · 0.45
getNameMethod · 0.45
resolveMethod · 0.45
incRefCountMethod · 0.45

Tested by

no test coverage detected