aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2015-12-23 23:22:08 +0100
committerEugene Sandulenko2015-12-27 15:41:00 +0100
commit5478cbe9c8f9f119d621b91d3fe01f62691bde57 (patch)
tree766dadb8cbb15f67483170359b924c2c872f2369 /engines/wage
parent6d4a9f54e1f41ebc506cbf177bf2d18ae056a99f (diff)
downloadscummvm-rg350-5478cbe9c8f9f119d621b91d3fe01f62691bde57.tar.gz
scummvm-rg350-5478cbe9c8f9f119d621b91d3fe01f62691bde57.tar.bz2
scummvm-rg350-5478cbe9c8f9f119d621b91d3fe01f62691bde57.zip
WAGE: Implement non0direct comparisons
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/script.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 8953fe1507..ae31d636ba 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -651,34 +651,38 @@ bool Script::eval(Operand *lhs, const char *op, Operand *rhs) {
return compare(lhs, rhs, comparators[cmp].cmp);
}
-#if 0
// Now, try partial matches.
+ Operand *c1, *c2;
for (int cmp = 0; comparators[cmp].op != 0; cmp++) {
- if (comparators[cmp].op == op[0])
- if (lhs->_typecomparators[cmp].o1 == lhs->_type)
- }
-
- for (PairEvaluator e : handlers) {
- Operand converted;
- if (e.lhsType == o1.type && (converted = convertOperand(o2, e.rhsType)) != null) {
- e.evaluatePair(o1, converted);
- return;
- } else if (e.rhsType == o2.type && (converted = convertOperand(o1, e.lhsType)) != null) {
- e.evaluatePair(converted, o2);
- return;
+ if (comparators[cmp].op == op[0]) {
+ if (comparators[cmp].o1 == lhs->_type &&
+ (c2 = convertOperand(rhs, comparators[cmp].o2)) != NULL) {
+ bool res = compare(lhs, c2, comparators[cmp].cmp);
+ delete c2;
+
+ return res;
+ } else if (comparators[cmp].o2 == rhs->_type &&
+ (c1 = convertOperand(lhs, comparators[cmp].o1)) != NULL) {
+ bool res = compare(c1, rhs, comparators[cmp].cmp);
+ delete c1;
+ return res;
+ }
}
}
// Now, try double conversion.
- for (PairEvaluator e : handlers) {
- Operand c1, c2;
- if ((c1 = convertOperand(o1, e.lhsType)) != null &&
- (c2 = convertOperand(o2, e.rhsType)) != null) {
- e.evaluatePair(c1, c2);
- return;
+ for (int cmp = 0; comparators[cmp].op != 0; cmp++) {
+ if ((c1 = convertOperand(lhs, comparators[cmp].o1)) != NULL) {
+ if ((c2 = convertOperand(rhs, comparators[cmp].o2)) != NULL) {
+ bool res = compare(c1, c2, comparators[cmp].cmp);
+ delete c1;
+ delete c2;
+
+ return res;
+ }
+ delete c1;
}
}
-#endif
}
return false;