mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Update console.h
This commit is contained in:
parent
41c3f610be
commit
2207ae4a65
1 changed files with 11 additions and 4 deletions
|
|
@ -150,6 +150,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
S32 type;
|
S32 type;
|
||||||
|
U32 bufferLen;
|
||||||
|
|
||||||
static DataChunker sConversionAllocator;
|
static DataChunker sConversionAllocator;
|
||||||
|
|
||||||
|
|
@ -159,24 +160,27 @@ public:
|
||||||
|
|
||||||
TORQUE_FORCEINLINE void cleanupData()
|
TORQUE_FORCEINLINE void cleanupData()
|
||||||
{
|
{
|
||||||
if (type == cvString)
|
if (type <= cvString && bufferLen > 0)
|
||||||
{
|
{
|
||||||
if (s != StringTable->EmptyString())
|
dFree(s);
|
||||||
dFree(s);
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s = const_cast<char*>(StringTable->EmptyString());
|
||||||
type = ConsoleValueType::cvNULL;
|
type = ConsoleValueType::cvNULL;
|
||||||
}
|
}
|
||||||
ConsoleValue()
|
ConsoleValue()
|
||||||
{
|
{
|
||||||
type = ConsoleValueType::cvSTEntry;
|
type = ConsoleValueType::cvSTEntry;
|
||||||
s = const_cast<char*>(StringTable->EmptyString());
|
s = const_cast<char*>(StringTable->EmptyString());
|
||||||
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleValue(const ConsoleValue& ref)
|
ConsoleValue(const ConsoleValue& ref)
|
||||||
{
|
{
|
||||||
type = ConsoleValueType::cvSTEntry;
|
type = ConsoleValueType::cvSTEntry;
|
||||||
s = const_cast<char*>(StringTable->EmptyString());
|
s = const_cast<char*>(StringTable->EmptyString());
|
||||||
|
bufferLen = 0;
|
||||||
|
|
||||||
switch (ref.type)
|
switch (ref.type)
|
||||||
{
|
{
|
||||||
|
|
@ -317,11 +321,14 @@ public:
|
||||||
setEmptyString();
|
setEmptyString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanupData();
|
cleanupData();
|
||||||
|
|
||||||
type = ConsoleValueType::cvString;
|
type = ConsoleValueType::cvString;
|
||||||
|
|
||||||
s = (char*)dMalloc(len + 1);
|
s = (char*)dMalloc(len + 1);
|
||||||
|
|
||||||
|
bufferLen = len + 1;
|
||||||
s[len] = '\0';
|
s[len] = '\0';
|
||||||
dStrcpy(s, val, len + 1);
|
dStrcpy(s, val, len + 1);
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +349,7 @@ public:
|
||||||
|
|
||||||
TORQUE_FORCEINLINE void setStringTableEntry(StringTableEntry val)
|
TORQUE_FORCEINLINE void setStringTableEntry(StringTableEntry val)
|
||||||
{
|
{
|
||||||
//cleanupData();
|
cleanupData();
|
||||||
type = ConsoleValueType::cvSTEntry;
|
type = ConsoleValueType::cvSTEntry;
|
||||||
s = const_cast<char*>(val);
|
s = const_cast<char*>(val);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue