[Scummvm-git-logs] scummvm master -> 9880d1207d6e9729caf9e6beb51d74bae8f0efa9

sev- sev at scummvm.org
Thu May 14 22:16:37 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7322241247 DIRECTOR: LINGO: Simplify code
9880d1207d DIRECTOR: LINGO: <Void> equals to 0 in comparison


Commit: 7322241247195db613de28fd310e5c7ff1bd7f00
    https://github.com/scummvm/scummvm/commit/7322241247195db613de28fd310e5c7ff1bd7f00
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-15T00:16:16+02:00

Commit Message:
DIRECTOR: LINGO: Simplify code

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 385d6e4f00..ecc0dac0bc 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -644,38 +644,38 @@ int Datum::compareTo(Datum &d, bool ignoreCase) {
 	if (type == SYMBOL && d.type == SYMBOL) {
 		// TODO: Implement union comparisons
 		return ignoreCase ? u.sym->name.compareToIgnoreCase(d.u.sym->name) : u.sym->name.compareTo(d.u.sym->name);
-	} else {
-		int alignType = g_lingo->getAlignedType(*this, d);
+	}
 
-		if ((alignType == VOID && (type == STRING || d.type == STRING)) || (type == STRING && d.type == STRING)) {
-			if (ignoreCase) {
-				return toLowercaseMac(asString()).compareTo(toLowercaseMac(d.asString()));
-			} else {
-				return asString().compareTo(d.asString());
-			}
-		} else if (alignType == FLOAT) {
-			double f1 = asFloat();
-			double f2 = d.asFloat();
-			if (f1 < f2) {
-				return -1;
-			} else if (f1 == f2) {
-				return 0;
-			} else {
-				return 1;
-			}
-		} else if (alignType == INT) {
-			double i1 = asInt();
-			double i2 = d.asInt();
-			if (i1 < i2) {
-				return -1;
-			} else if (i1 == i2) {
-				return 0;
-			} else {
-				return 1;
-			}
+	int alignType = g_lingo->getAlignedType(*this, d);
+
+	if ((alignType == VOID && (type == STRING || d.type == STRING)) || (type == STRING && d.type == STRING)) {
+		if (ignoreCase) {
+			return toLowercaseMac(asString()).compareTo(toLowercaseMac(d.asString()));
+		} else {
+			return asString().compareTo(d.asString());
+		}
+	} else if (alignType == FLOAT) {
+		double f1 = asFloat();
+		double f2 = d.asFloat();
+		if (f1 < f2) {
+			return -1;
+		} else if (f1 == f2) {
+			return 0;
 		} else {
-			error("Invalid comparison between types %s and %s", type2str(), d.type2str());
+			return 1;
 		}
+	} else if (alignType == INT) {
+		double i1 = asInt();
+		double i2 = d.asInt();
+		if (i1 < i2) {
+			return -1;
+		} else if (i1 == i2) {
+			return 0;
+		} else {
+			return 1;
+		}
+	} else {
+		error("Invalid comparison between types %s and %s", type2str(), d.type2str());
 	}
 }
 


Commit: 9880d1207d6e9729caf9e6beb51d74bae8f0efa9
    https://github.com/scummvm/scummvm/commit/9880d1207d6e9729caf9e6beb51d74bae8f0efa9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-15T00:16:26+02:00

Commit Message:
DIRECTOR: LINGO: <Void> equals to 0 in comparison

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ecc0dac0bc..b344c3c0cb 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -439,6 +439,12 @@ int Lingo::getAlignedType(Datum &d1, Datum &d2) {
 		}
 	}
 
+	// VOID equals to 0
+	if (d1Type == VOID)
+		d1Type = INT;
+	if (d2Type == VOID)
+		d2Type = INT;
+
 	if (d1Type == FLOAT || d2Type == FLOAT) {
 		opType = FLOAT;
 	} else if (d1Type == INT && d2Type == INT) {




More information about the Scummvm-git-logs mailing list