| 1748 | } |
| 1749 | |
| 1750 | const 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 |
no test coverage detected