mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Disable static value evaluation for visible expression when optimizations are turned off
This commit is contained in:
parent
64a1e4c176
commit
2df12e101e
@ -493,10 +493,23 @@ namespace IW4
|
||||
if (expression == nullptr)
|
||||
return nullptr;
|
||||
|
||||
if (expression->IsStatic())
|
||||
bool isStatic;
|
||||
bool isTruthy;
|
||||
if(m_disable_optimizations)
|
||||
{
|
||||
const auto staticValue = expression->Evaluate();
|
||||
if (staticValue.IsTruthy())
|
||||
const auto* staticValue = dynamic_cast<const SimpleExpressionValue*>(expression);
|
||||
isStatic = staticValue != nullptr;
|
||||
isTruthy = isStatic && staticValue->IsTruthy();
|
||||
}
|
||||
else
|
||||
{
|
||||
isStatic = expression->IsStatic();
|
||||
isTruthy = isStatic && expression->Evaluate().IsTruthy();
|
||||
}
|
||||
|
||||
if (isStatic)
|
||||
{
|
||||
if (isTruthy)
|
||||
window->dynamicFlags[0] |= WINDOW_FLAG_VISIBLE;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -192,12 +192,8 @@ namespace test::game::iw4::menu::parsing::it
|
||||
REQUIRE(menu->window.rect.vertAlign == 2);
|
||||
REQUIRE(menu->window.style == 5);
|
||||
|
||||
REQUIRE(menu->visibleExp != nullptr);
|
||||
REQUIRE(menu->visibleExp->entries != nullptr);
|
||||
REQUIRE(menu->visibleExp->numEntries == 1);
|
||||
REQUIRE(menu->visibleExp->entries[0].type == expressionEntryType::EET_OPERAND);
|
||||
REQUIRE(menu->visibleExp->entries[0].data.operand.dataType == expDataType::VAL_INT);
|
||||
REQUIRE(menu->visibleExp->entries[0].data.operand.internals.intVal > 0);
|
||||
REQUIRE(menu->visibleExp == nullptr);
|
||||
REQUIRE(menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE);
|
||||
|
||||
REQUIRE(menu->onOpen != nullptr);
|
||||
REQUIRE(menu->onOpen->eventHandlerCount == 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user