| 531 | //----------------------------------------------------------------------------- |
| 532 | |
| 533 | bool 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 |
nothing calls this directly
no test coverage detected