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

Function getFormattedData

Engine/source/console/console.cpp:1836–1873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1834}
1835
1836const char *getFormattedData(S32 type, const char *data, const EnumTable *tbl, BitSet32 flag)
1837{
1838 ConsoleBaseType *cbt = ConsoleBaseType::getType( type );
1839 AssertFatal(cbt, "Con::getData - could not resolve type ID!");
1840
1841 // Datablock types are just a datablock
1842 // name and don't ever need formatting.
1843 if ( cbt->isDatablock() )
1844 return data;
1845
1846 bool currWarn = gWarnUndefinedScriptVariables;
1847 gWarnUndefinedScriptVariables = false;
1848
1849 const char* globalValue = Con::getVariable(data);
1850
1851 gWarnUndefinedScriptVariables = currWarn;
1852
1853 if (dStrlen(globalValue) > 0)
1854 return globalValue;
1855
1856 void* variable = cbt->getNativeVariable();
1857
1858 if (variable)
1859 {
1860 Con::setData(type, variable, 0, 1, &data, tbl, flag);
1861 const char* formattedVal = Con::getData(type, variable, 0, tbl, flag);
1862
1863 static const U32 bufSize = 2048;
1864 char* returnBuffer = Con::getReturnBuffer(bufSize);
1865 dSprintf(returnBuffer, bufSize, "%s\0", formattedVal );
1866
1867 cbt->deleteNativeVariable(variable);
1868
1869 return returnBuffer;
1870 }
1871 else
1872 return data;
1873}
1874
1875//------------------------------------------------------------------------------
1876

Callers 1

updateObjectMethod · 0.85

Calls 10

getTypeFunction · 0.85
getVariableFunction · 0.85
setDataFunction · 0.85
getDataFunction · 0.85
getReturnBufferFunction · 0.85
dSprintfFunction · 0.85
dStrlenFunction · 0.50
isDatablockMethod · 0.45
getNativeVariableMethod · 0.45
deleteNativeVariableMethod · 0.45

Tested by

no test coverage detected