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