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

Method _setPersistentID

Engine/source/console/simObject.cpp:533–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531//-----------------------------------------------------------------------------
532
533bool SimObject::_setPersistentID( void* object, const char* index, const char* data )
534{
535 SimObject* simObject = reinterpret_cast< SimObject* >( object );
536
537 // Make sure we don't already have a PID.
538 if( simObject->getPersistentId() )
539 {
540 Con::errorf( "SimObject::_setPersistentID - cannot set a persistent ID on an object that already has a persistent ID assigned." );
541 return false;
542 }
543
544 SimPersistID* pid;
545 Con::setData( TypePID, &pid, 0, 1, &data );
546 if ( !pid )
547 return false;
548
549 // Make sure it's not already bound to an object.
550 if( pid->getObject() )
551 {
552 AssertWarn( pid->getObject() != simObject, "Sim::_setPersistentID - PID is bound to this object yet not assigned to it!" );
553
554 SimObject* otherObj = pid->getObject();
555 Con::errorf( "SimObject::_setPersistentID - UUID is already used by another object: '%s' -> %i:%s (%s)",
556 data, otherObj->getId(), otherObj->getClassName(), otherObj->getName() );
557
558 return false;
559 }
560
561 pid->resolve( simObject );
562 pid->incRefCount();
563 simObject->mPersistentId = pid;
564
565 return false;
566}
567
568//-----------------------------------------------------------------------------
569

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected