[Scummvm-git-logs] scummvm master -> 45371c6799db489e5d720f78e1b7ef5faab669fb
rvanlaar
noreply at scummvm.org
Mon Mar 14 09:09:59 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
45371c6799 DIRECTOR: LINGO: Add comparison INT and STRING
Commit: 45371c6799db489e5d720f78e1b7ef5faab669fb
https://github.com/scummvm/scummvm/commit/45371c6799db489e5d720f78e1b7ef5faab669fb
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-14T10:09:33+01:00
Commit Message:
DIRECTOR: LINGO: Add comparison INT and STRING
With INT and STRING comparisons:
- when the STRING can be parsed as an INT then it's an INT comparison,
otherwise
- the INT is parsed as STRING and it's an STRING comparison.
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/tests/equality.lingo
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index f7024e063d6..4838e94c772 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -593,6 +593,8 @@ int Lingo::getAlignedType(const Datum &d1, const Datum &d2, bool numsOnly) {
opType = FLOAT;
} else if (d1Type == INT && d2Type == INT) {
opType = INT;
+ } else if ((d1Type == STRING && d2Type == INT) || (d1Type == INT && d2Type == STRING)) {
+ opType = STRING;
}
return opType;
diff --git a/engines/director/lingo/tests/equality.lingo b/engines/director/lingo/tests/equality.lingo
index b2549fc8865..dc91a083362 100644
--- a/engines/director/lingo/tests/equality.lingo
+++ b/engines/director/lingo/tests/equality.lingo
@@ -10,5 +10,9 @@ scummvmAssert(0 <> "")
scummvmAssert(1 <> cast 1)
scummvmAssert("test" <> #test)
+-- Comparison between string and ints parses the int as string
+scummvmAssert("string" > 0)
+scummvmAssert("1string" < 2)
+
-- Invalid comparisons should return FALSE
-scummvmAssert(not ("ST_INTRO" <= 0))
+scummvmAssert(not (#test <= 0))
More information about the Scummvm-git-logs
mailing list