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

Function getUniqueName

Engine/source/console/simManager.cpp:450–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450String getUniqueName( const char *inName )
451{
452 String outName( inName );
453
454 if ( outName.isEmpty() )
455 return String::EmptyString;
456
457 SimObject *dummy;
458
459 if ( !Sim::findObject( outName, dummy ) )
460 return outName;
461
462 S32 suffixNumb = -1;
463 String nameStr( String::GetTrailingNumber( outName, suffixNumb ) );
464 suffixNumb = mAbs( suffixNumb ) + 1;
465
466 #define MAX_TRIES 100
467
468 for ( U32 i = 0; i < MAX_TRIES; i++ )
469 {
470 outName = String::ToString( "%s%d", nameStr.c_str(), suffixNumb );
471
472 if ( !Sim::findObject( outName, dummy ) )
473 return outName;
474
475 suffixNumb++;
476 }
477
478 Con::errorf( "Sim::getUniqueName( %s ) - failed after %d attempts", inName, MAX_TRIES );
479 return String::EmptyString;
480}
481
482String getUniqueInternalName( const char *inName, SimSet *inSet, bool searchChildren )
483{

Callers 6

cloneMethod · 0.70
restoreMethod · 0.70
sim.cppFile · 0.70
mapMaterialMethod · 0.50
redoMethod · 0.50
importShapeAssetMethod · 0.50

Calls 5

mAbsFunction · 0.85
findObjectFunction · 0.70
errorfFunction · 0.70
isEmptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected