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

Method getDataField

Engine/source/console/simObject.cpp:979–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977//-----------------------------------------------------------------------------
978
979const char *SimObject::getDataField(StringTableEntry slotName, const char *array)
980{
981 if(mFlags.test(ModStaticFields))
982 {
983 S32 array1 = array ? dAtoi(array) : -1;
984 const AbstractClassRep::Field *fld = findField(slotName);
985
986 if(fld)
987 {
988 if(array1 == -1 && fld->elementCount == 1)
989 return (*fld->getDataFn)( this, Con::getData(fld->type, (void *) (((const char *)this) + fld->offset), 0, fld->table, fld->flag) );
990 if(array1 >= 0 && array1 < fld->elementCount)
991 return (*fld->getDataFn)( this, Con::getData(fld->type, (void *) (((const char *)this) + fld->offset), array1, fld->table, fld->flag) );// + typeSizes[fld.type] * array1));
992 return "";
993 }
994 }
995
996 if(mFlags.test(ModDynamicFields))
997 {
998 if(!mFieldDictionary)
999 return "";
1000
1001 if(!array)
1002 {
1003 if (const char* val = mFieldDictionary->getFieldValue(slotName))
1004 return val;
1005 }
1006 else
1007 {
1008 static char buf[256];
1009 dStrcpy(buf, slotName);
1010 dStrcat(buf, array);
1011 if (const char* val = mFieldDictionary->getFieldValue(StringTable->insert(buf)))
1012 return val;
1013 }
1014 }
1015
1016 return "";
1017}
1018
1019
1020const char *SimObject::getPrefixedDataField(StringTableEntry fieldName, const char *array)

Callers 15

simObject.cppFile · 0.80
getFieldComponentFunction · 0.80
setFieldComponentFunction · 0.80
execMethod · 0.80
getFieldValueMethod · 0.80
updateObjectMethod · 0.80
getVariableObjectFieldFunction · 0.80
getObjectTokenFieldFunction · 0.80
TESTFunction · 0.80
registerModuleMethod · 0.80
SimObject_GetDataFieldFunction · 0.80

Calls 7

getDataFunction · 0.85
dStrcpyFunction · 0.85
dStrcatFunction · 0.85
dAtoiFunction · 0.70
testMethod · 0.45
getFieldValueMethod · 0.45
insertMethod · 0.45

Tested by 1

TESTFunction · 0.64