| 1834 | } |
| 1835 | |
| 1836 | const 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 |
no test coverage detected