mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 22:10:36 +00:00
az changes
This commit is contained in:
parent
1ddc7219a5
commit
c6e0eade04
4 changed files with 19 additions and 29 deletions
|
|
@ -71,7 +71,7 @@ char* ConsoleValue::convertToBuffer() const
|
|||
|
||||
const char* ConsoleValue::getConsoleData() const
|
||||
{
|
||||
return Con::getData(ct->consoleType, ct->dataPtr, 0, ct->enumTable);
|
||||
return Con::getData(type, dataPtr, 0, enumTable);
|
||||
}
|
||||
|
||||
ConsoleDocFragment* ConsoleDocFragment::smFirst;
|
||||
|
|
|
|||
|
|
@ -128,15 +128,9 @@ enum ConsoleValueType
|
|||
cvConsoleValueType = 0
|
||||
};
|
||||
|
||||
struct ConsoleValueConsoleType
|
||||
{
|
||||
S32 consoleType;
|
||||
void* dataPtr;
|
||||
EnumTable* enumTable;
|
||||
};
|
||||
|
||||
class ConsoleValue
|
||||
{
|
||||
public:
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4201 ) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
union
|
||||
|
|
@ -150,7 +144,8 @@ class ConsoleValue
|
|||
|
||||
struct
|
||||
{
|
||||
ConsoleValueConsoleType* ct;
|
||||
void* dataPtr;
|
||||
EnumTable* enumTable;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -164,15 +159,14 @@ class ConsoleValue
|
|||
|
||||
TORQUE_FORCEINLINE void cleanupData()
|
||||
{
|
||||
if (type == ConsoleValueType::cvString)
|
||||
if (type == cvString)
|
||||
{
|
||||
if (s != StringTable->EmptyString())
|
||||
dFree(s);
|
||||
}
|
||||
|
||||
type = ConsoleValueType::cvNULL;
|
||||
}
|
||||
|
||||
public:
|
||||
ConsoleValue()
|
||||
{
|
||||
type = ConsoleValueType::cvSTEntry;
|
||||
|
|
@ -199,7 +193,7 @@ public:
|
|||
setString(ref.s);
|
||||
break;
|
||||
default:
|
||||
setConsoleData(ref.ct->consoleType, ref.ct->dataPtr, ref.ct->enumTable);
|
||||
setConsoleData(ref.type, ref.dataPtr, ref.enumTable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -224,7 +218,7 @@ public:
|
|||
setString(ref.s);
|
||||
break;
|
||||
default:
|
||||
setConsoleData(ref.ct->consoleType, ref.ct->dataPtr, ref.ct->enumTable);
|
||||
setConsoleData(ref.type, ref.dataPtr, ref.enumTable);
|
||||
break;
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -322,8 +316,6 @@ public:
|
|||
}
|
||||
cleanupData();
|
||||
|
||||
U32 oldLen = dStrlen(s);
|
||||
|
||||
type = ConsoleValueType::cvString;
|
||||
s = (char*)dMalloc(len + 1);
|
||||
|
||||
|
|
@ -357,12 +349,13 @@ public:
|
|||
setStringTableEntry(StringTable->EmptyString());
|
||||
}
|
||||
|
||||
TORQUE_FORCEINLINE void setConsoleData(S32 consoleType, void* dataPtr, const EnumTable* enumTable)
|
||||
TORQUE_FORCEINLINE void setConsoleData(S32 inConsoleType, void* inDataPtr, const EnumTable* inEnumTable)
|
||||
{
|
||||
cleanupData();
|
||||
type = ConsoleValueType::cvConsoleValueType;
|
||||
ct = new ConsoleValueConsoleType{ consoleType, dataPtr, const_cast<EnumTable*>(enumTable) };
|
||||
}
|
||||
type = inConsoleType;
|
||||
dataPtr = inDataPtr;
|
||||
enumTable = const_cast<EnumTable*>(inEnumTable);
|
||||
};
|
||||
|
||||
TORQUE_FORCEINLINE S32 getType() const
|
||||
{
|
||||
|
|
@ -384,11 +377,11 @@ public:
|
|||
return type >= ConsoleValueType::cvConsoleValueType;
|
||||
}
|
||||
|
||||
TORQUE_FORCEINLINE ConsoleValueConsoleType* getConsoleType() const
|
||||
TORQUE_FORCEINLINE S32 getConsoleType() const
|
||||
{
|
||||
if(type >= ConsoleValueType::cvConsoleValueType)
|
||||
{
|
||||
return ct;
|
||||
return type;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -349,8 +349,7 @@ public:
|
|||
if (value.isConsoleType())
|
||||
{
|
||||
const char* dptr = Con::getData(TypeS32, &val, 0);
|
||||
ConsoleValueConsoleType* cvt = value.getConsoleType();
|
||||
Con::setData(cvt->consoleType, cvt->dataPtr, 0, 1, &dptr, cvt->enumTable);
|
||||
Con::setData(value.type, value.dataPtr, 0, 1, &dptr, value.enumTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -373,8 +372,7 @@ public:
|
|||
if (value.isConsoleType())
|
||||
{
|
||||
const char* dptr = Con::getData(TypeF32, &val, 0);
|
||||
ConsoleValueConsoleType* cvt = value.getConsoleType();
|
||||
Con::setData(cvt->consoleType, cvt->dataPtr, 0, 1, &dptr, cvt->enumTable);
|
||||
Con::setData(value.type, value.dataPtr, 0, 1, &dptr, value.enumTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -397,8 +395,7 @@ public:
|
|||
|
||||
if (value.isConsoleType())
|
||||
{
|
||||
ConsoleValueConsoleType* cvt = value.getConsoleType();
|
||||
Con::setData(cvt->consoleType, cvt->dataPtr, 0, 1, &val, cvt->enumTable);
|
||||
Con::setData(value.type, value.dataPtr, 0, 1, &val, value.enumTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ static void dumpVariable( Stream& stream,
|
|||
|
||||
// Skip variables for which we can't decipher their type.
|
||||
|
||||
ConsoleBaseType* type = ConsoleBaseType::getType( entry->value.getConsoleType()->consoleType );
|
||||
ConsoleBaseType* type = ConsoleBaseType::getType( entry->value.type );
|
||||
if( !type )
|
||||
{
|
||||
Con::errorf( "Can't find type for variable '%s'", entry->name );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue