mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +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)
|
if (expression == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (expression->IsStatic())
|
bool isStatic;
|
||||||
|
bool isTruthy;
|
||||||
|
if(m_disable_optimizations)
|
||||||
{
|
{
|
||||||
const auto staticValue = expression->Evaluate();
|
const auto* staticValue = dynamic_cast<const SimpleExpressionValue*>(expression);
|
||||||
if (staticValue.IsTruthy())
|
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;
|
window->dynamicFlags[0] |= WINDOW_FLAG_VISIBLE;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -192,12 +192,8 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
REQUIRE(menu->window.rect.vertAlign == 2);
|
REQUIRE(menu->window.rect.vertAlign == 2);
|
||||||
REQUIRE(menu->window.style == 5);
|
REQUIRE(menu->window.style == 5);
|
||||||
|
|
||||||
REQUIRE(menu->visibleExp != nullptr);
|
REQUIRE(menu->visibleExp == nullptr);
|
||||||
REQUIRE(menu->visibleExp->entries != nullptr);
|
REQUIRE(menu->window.dynamicFlags[0] & WINDOW_FLAG_VISIBLE);
|
||||||
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->onOpen != nullptr);
|
REQUIRE(menu->onOpen != nullptr);
|
||||||
REQUIRE(menu->onOpen->eventHandlerCount == 1);
|
REQUIRE(menu->onOpen->eventHandlerCount == 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user