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

Function getFormattedData

Engine/source/console/console.cpp:1750–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1748}
1749
1750const char *getFormattedData(S32 type, const char *data, const EnumTable *tbl, BitSet32 flag)
1751{
1752 ConsoleBaseType *cbt = ConsoleBaseType::getType( type );
1753 AssertFatal(cbt, "Con::getData - could not resolve type ID!");
1754
1755 // Datablock types are just a datablock
1756 // name and don't ever need formatting.
1757 if ( cbt->isDatablock() )
1758 return data;
1759
1760 bool currWarn = gWarnUndefinedScriptVariables;
1761 gWarnUndefinedScriptVariables = false;
1762
1763 const char* globalValue = Con::getVariable(data);
1764
1765 gWarnUndefinedScriptVariables = currWarn;
1766
1767 if (dStrlen(globalValue) > 0)
1768 return globalValue;
1769
1770 void* variable = cbt->getNativeVariable();
1771
1772 if (variable)
1773 {
1774 Con::setData(type, variable, 0, 1, &data, tbl, flag);
1775 const char* formattedVal = Con::getData(type, variable, 0, tbl, flag);
1776
1777 static const U32 bufSize = 2048;
1778 char* returnBuffer = Con::getReturnBuffer(bufSize);
1779 dSprintf(returnBuffer, bufSize, "%s\0", formattedVal );
1780
1781 cbt->deleteNativeVariable(variable);
1782
1783 return returnBuffer;
1784 }
1785 else
1786 return data;
1787}
1788
1789//------------------------------------------------------------------------------
1790

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