mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
optimizations
This commit is contained in:
parent
dcd01e1231
commit
55b0ecb487
3 changed files with 38 additions and 33 deletions
|
|
@ -46,31 +46,21 @@
|
|||
extern StringStack STR;
|
||||
extern ConsoleValueStack<4096> gCallStack;
|
||||
|
||||
S32 ConsoleValue::sBufferOffset = 0;
|
||||
char ConsoleValue::sConversionBuffer[ConversionBufferSize];
|
||||
|
||||
void ConsoleValue::init()
|
||||
{
|
||||
sBufferOffset = 0;
|
||||
dMemset(sConversionBuffer, '\0', ConversionBufferSize);
|
||||
}
|
||||
|
||||
char* ConsoleValue::convertToBuffer() const
|
||||
{
|
||||
sBufferOffset += StringSize;
|
||||
if (sBufferOffset > ConversionBufferSize)
|
||||
{
|
||||
dMemset(sConversionBuffer, '\0', ConversionBufferSize);
|
||||
sBufferOffset = 0;
|
||||
}
|
||||
|
||||
char* offset = sConversionBuffer + sBufferOffset;
|
||||
if (type == ConsoleValueType::cvFloat)
|
||||
dSprintf(offset, StringSize, "%.9g", f);
|
||||
dSprintf(sConversionBuffer, ConversionBufferSize, "%.9g", f);
|
||||
else
|
||||
dSprintf(offset, StringSize, "%lld", i);
|
||||
dSprintf(sConversionBuffer, ConversionBufferSize, "%lld", i);
|
||||
|
||||
return offset;
|
||||
return sConversionBuffer;
|
||||
}
|
||||
|
||||
const char* ConsoleValue::getConsoleData() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue