| 581 | //----------------------------------------------------------------------------- |
| 582 | |
| 583 | bool 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 |
nothing calls this directly
no test coverage detected