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

Method clone

Engine/source/console/simObject.cpp:1463–1492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1461//-----------------------------------------------------------------------------
1462
1463SimObject* SimObject::clone()
1464{
1465 if( !getClassRep() )
1466 return NULL;
1467
1468 ConsoleObject* conObject = getClassRep()->create();
1469 if( !conObject )
1470 return NULL;
1471
1472 SimObject* simObject = dynamic_cast< SimObject* >( conObject );
1473 if( !simObject )
1474 {
1475 delete conObject;
1476 return NULL;
1477 }
1478
1479 simObject->assignFieldsFrom( this );
1480
1481 String name = Sim::getUniqueName( getName() );
1482 if( !simObject->registerObject( name.c_str() ) )
1483 {
1484 delete simObject;
1485 return NULL;
1486 }
1487
1488 if( getGroup() )
1489 getGroup()->addObject( simObject );
1490
1491 return simObject;
1492}
1493
1494//-----------------------------------------------------------------------------
1495

Callers 1

simObject.cppFile · 0.45

Calls 7

assignFieldsFromMethod · 0.80
getUniqueNameFunction · 0.70
getNameFunction · 0.50
createMethod · 0.45
registerObjectMethod · 0.45
c_strMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected