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

Method addVariable

Engine/source/console/consoleInternal.cpp:679–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679Dictionary::Entry* Dictionary::addVariable( const char *name,
680 S32 type,
681 void *dataPtr,
682 const char* usage )
683{
684 AssertFatal( type >= 0, "Dictionary::addVariable - Got bad type!" );
685
686 if(name[0] != '$')
687 {
688 scratchBuffer[0] = '$';
689 dStrcpy(scratchBuffer + 1, name);
690 name = scratchBuffer;
691 }
692
693 Entry *ent = add(StringTable->insert(name));
694
695 if ( ent->value.type <= ConsoleValue::TypeInternalString &&
696 ent->value.bufferLen > 0 )
697 dFree(ent->value.sval);
698
699 ent->value.type = type;
700 ent->value.dataPtr = dataPtr;
701 ent->mUsage = usage;
702
703 // Fetch enum table, if any.
704
705 ConsoleBaseType* conType = ConsoleBaseType::getType( type );
706 AssertFatal( conType, "Dictionary::addVariable - invalid console type" );
707 ent->value.enumTable = conType->getEnumTable();
708
709 return ent;
710}
711
712bool Dictionary::removeVariable(StringTableEntry name)
713{

Callers 2

addVariableFunction · 0.80
addConstantFunction · 0.80

Calls 6

dStrcpyFunction · 0.85
getTypeFunction · 0.85
addFunction · 0.50
dFreeFunction · 0.50
insertMethod · 0.45
getEnumTableMethod · 0.45

Tested by

no test coverage detected