mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-01 06:10:42 +00:00
allow comparisons between ints and translation IDs in pre 4.12 ZScript.
This commit is contained in:
parent
eaf43dfb96
commit
8e319a7669
1 changed files with 22 additions and 1 deletions
|
@ -3826,6 +3826,16 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx)
|
||||||
delete left;
|
delete left;
|
||||||
left = x;
|
left = x;
|
||||||
}
|
}
|
||||||
|
else if (left->IsNumeric() && right->ValueType == TypeTranslationID && ctx.Version < MakeVersion(4, 12))
|
||||||
|
{
|
||||||
|
right = new FxTypeCast(right, TypeSInt32, true);
|
||||||
|
SAFE_RESOLVE(right, ctx);
|
||||||
|
}
|
||||||
|
else if (right->IsNumeric() && left->ValueType == TypeTranslationID && ctx.Version < MakeVersion(4, 12))
|
||||||
|
{
|
||||||
|
left = new FxTypeCast(left, TypeSInt32, true);
|
||||||
|
SAFE_RESOLVE(left, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
if (left->ValueType == TypeString || right->ValueType == TypeString)
|
if (left->ValueType == TypeString || right->ValueType == TypeString)
|
||||||
{
|
{
|
||||||
|
@ -3851,7 +3861,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx)
|
||||||
}
|
}
|
||||||
ValueType = TypeString;
|
ValueType = TypeString;
|
||||||
}
|
}
|
||||||
else if (left->IsNumeric() && right->IsNumeric())
|
if (left->IsNumeric() && right->IsNumeric())
|
||||||
{
|
{
|
||||||
if (left->IsInteger() && right->IsInteger())
|
if (left->IsInteger() && right->IsInteger())
|
||||||
{
|
{
|
||||||
|
@ -4118,6 +4128,17 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx)
|
||||||
delete left;
|
delete left;
|
||||||
left = x;
|
left = x;
|
||||||
}
|
}
|
||||||
|
else if (left->IsNumeric() && right->ValueType == TypeTranslationID && ctx.Version < MakeVersion(4, 12))
|
||||||
|
{
|
||||||
|
right = new FxIntCast(right, true, true);
|
||||||
|
SAFE_RESOLVE(right, ctx);
|
||||||
|
}
|
||||||
|
else if (right->IsNumeric() && left->ValueType == TypeTranslationID && ctx.Version < MakeVersion(4, 12))
|
||||||
|
{
|
||||||
|
left = new FxTypeCast(left, TypeSInt32, true);
|
||||||
|
SAFE_RESOLVE(left, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
// Special cases: Compare strings and names with names, sounds, colors, state labels and class types.
|
// Special cases: Compare strings and names with names, sounds, colors, state labels and class types.
|
||||||
// These are all types a string can be implicitly cast into, so for convenience, so they should when doing a comparison.
|
// These are all types a string can be implicitly cast into, so for convenience, so they should when doing a comparison.
|
||||||
if ((left->ValueType == TypeString || left->ValueType == TypeName) &&
|
if ((left->ValueType == TypeString || left->ValueType == TypeName) &&
|
||||||
|
|
Loading…
Reference in a new issue