from marauder: proper enumtable lookup

This commit is contained in:
AzaezelX 2025-03-07 00:12:09 -06:00
parent d8fcbb7863
commit 45bb368762

View file

@ -1525,16 +1525,24 @@ void GuiInspectorTypeBitMask32::setValue( StringTableEntry value )
if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on
{ {
BitSet32 bitMask; BitSet32 bitMask;
const EnumTable* tbl = mInspector->getInspectObject(0)->getClassRep()->getEnumTable(); const EngineEnumTable* table = mField->table;
if (tbl) if (!table)
{ {
const U32 numEnums = tbl->getNumValues(); ConsoleBaseType* type = ConsoleBaseType::getType(mField->type);
if (type && type->getEnumTable())
table = type->getEnumTable();
}
if (table)
{
const EngineEnumTable& t = *table;
const U32 numEntries = t.getNumValues();
String inString(value); String inString(value);
for (U32 i = 0; i < numEnums; i++) for (U32 i = 0; i < numEntries; i++)
{ {
if (inString.find((*tbl)[i].getName()) != String::NPos) if (inString.find(t[i].getName()) != String::NPos)
bitMask.set(BIT(i)); bitMask.set(t[i].getInt());
} }
mask = bitMask.getMask(); mask = bitMask.getMask();
} }