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

Method getDataField

Engine/source/console/simObject.cpp:1087–1125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1085//-----------------------------------------------------------------------------
1086
1087const char *SimObject::getDataField(StringTableEntry slotName, const char *array)
1088{
1089 if(mFlags.test(ModStaticFields))
1090 {
1091 S32 array1 = array ? dAtoi(array) : -1;
1092 const AbstractClassRep::Field *fld = findField(slotName);
1093
1094 if(fld)
1095 {
1096 if(array1 == -1 && fld->elementCount == 1)
1097 return (*fld->getDataFn)( this, Con::getData(fld->type, (void *) (((const char *)this) + fld->offset), 0, fld->table, fld->flag) );
1098 if(array1 >= 0 && array1 < fld->elementCount)
1099 return (*fld->getDataFn)( this, Con::getData(fld->type, (void *) (((const char *)this) + fld->offset), array1, fld->table, fld->flag) );// + typeSizes[fld.type] * array1));
1100 return "";
1101 }
1102 }
1103
1104 if(mFlags.test(ModDynamicFields))
1105 {
1106 if(!mFieldDictionary)
1107 return "";
1108
1109 if(!array)
1110 {
1111 if (const char* val = mFieldDictionary->getFieldValue(slotName))
1112 return val;
1113 }
1114 else
1115 {
1116 static char buf[256];
1117 dStrcpy(buf, slotName, 256);
1118 dStrcat(buf, array, 256);
1119 if (const char* val = mFieldDictionary->getFieldValue(StringTable->insert(buf)))
1120 return val;
1121 }
1122 }
1123
1124 return "";
1125}
1126
1127
1128const char *SimObject::getPrefixedDataField(StringTableEntry fieldName, const char *array)

Callers 15

getValueMethod · 0.80
onNewDataBlockMethod · 0.80
getValueMethod · 0.80
writeFieldsMethod · 0.80
simObject.cppFile · 0.80
getFieldComponentFunction · 0.80
setFieldComponentFunction · 0.80
execMethod · 0.80
getFieldValueMethod · 0.80
updateObjectMethod · 0.80
getVariableObjectFieldFunction · 0.80

Calls 7

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

Tested by 1

TESTFunction · 0.64