[Scummvm-git-logs] scummvm master -> 07b6879ccc9971d3408813a0c57490c1e34cfb76

rvanlaar noreply at scummvm.org
Thu Sep 29 10:20:46 UTC 2022


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

Summary:
1c2835c5a7 DIRECTOR: Add BUILDBOT to warnings in lingo-utils.h
beacb43d1b DIRECTOR: Implement lingo edgecases
07b6879ccc DIRECTOR: Add test in the.lingo for length of integer


Commit: 1c2835c5a70905a0439b0c72d7df8e7b19ae7562
    https://github.com/scummvm/scummvm/commit/1c2835c5a70905a0439b0c72d7df8e7b19ae7562
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2022-09-29T12:20:40+02:00

Commit Message:
DIRECTOR: Add BUILDBOT to warnings in lingo-utils.h

Changed paths:
    engines/director/lingo/lingo-utils.h


diff --git a/engines/director/lingo/lingo-utils.h b/engines/director/lingo/lingo-utils.h
index b26f8794923..195d4118be9 100644
--- a/engines/director/lingo/lingo-utils.h
+++ b/engines/director/lingo/lingo-utils.h
@@ -24,32 +24,32 @@
 
 #define ARGNUMCHECK(n) \
 	if (nargs != (n)) { \
-		warning("%s: expected %d argument%s, got %d", __FUNCTION__, (n), ((n) == 1 ? "" : "s"), nargs); \
+		warning("BUILDBOT: %s: expected %d argument%s, got %d", __FUNCTION__, (n), ((n) == 1 ? "" : "s"), nargs); \
 		g_lingo->dropStack(nargs); \
 		return; \
 	}
 
 #define TYPECHECK(datum,t) \
 	if ((datum).type != (t)) { \
-		warning("%s: %s arg should be of type %s, not %s", __FUNCTION__, #datum, #t, (datum).type2str()); \
+		warning("BUILDBOT: %s: %s arg should be of type %s, not %s", __FUNCTION__, #datum, #t, (datum).type2str()); \
 		return; \
 	}
 
 #define TYPECHECK2(datum, t1, t2)	\
 	if ((datum).type != (t1) && (datum).type != (t2)) { \
-		warning("%s: %s arg should be of type %s or %s, not %s", __FUNCTION__, #datum, #t1, #t2, (datum).type2str()); \
+		warning("BUILDBOT: %s: %s arg should be of type %s or %s, not %s", __FUNCTION__, #datum, #t1, #t2, (datum).type2str()); \
 		return; \
 	}
 
 #define TYPECHECK3(datum, t1, t2, t3)	\
 	if ((datum).type != (t1) && (datum).type != (t2) && (datum).type != (t3)) { \
-		warning("%s: %s arg should be of type %s, %s, or %s, not %s", __FUNCTION__, #datum, #t1, #t2, #t3, (datum).type2str()); \
+		warning("BUILDBOT: %s: %s arg should be of type %s, %s, or %s, not %s", __FUNCTION__, #datum, #t1, #t2, #t3, (datum).type2str()); \
 		return; \
 	}
 
 #define ARRBOUNDSCHECK(idx,array) \
 	if ((idx)-1 < 0 || (idx) > (int)(array).u.farr->arr.size()) { \
-		warning("%s: index out of bounds (%d of %d)", __FUNCTION__, (idx), (array).u.farr->arr.size()); \
+		warning("BUILDBOT: %s: index out of bounds (%d of %d)", __FUNCTION__, (idx), (array).u.farr->arr.size()); \
 		return; \
 	}
 


Commit: beacb43d1bf1e1c5b024df1201aaabd1486e77e4
    https://github.com/scummvm/scummvm/commit/beacb43d1bf1e1c5b024df1201aaabd1486e77e4
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2022-09-29T12:20:40+02:00

Commit Message:
DIRECTOR: Implement lingo edgecases

- The length of an int or float is always 0:
    i.e. the length of 123.9

- Add checks on numToChar:
    D3 will throw an error when doing numToChar on anything other than an int
    D4 will allow it and output a seemingly random character.

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 64e2d39ee87..bca3a797aa1 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -473,7 +473,6 @@ void LB::b_chars(int nargs) {
 
 void LB::b_charToNum(int nargs) {
 	Datum d = g_lingo->pop();
-
 	TYPECHECK(d, STRING);
 
 	Common::U32String str = d.asString().decode(Common::kUtf8);
@@ -487,6 +486,10 @@ void LB::b_charToNum(int nargs) {
 
 void LB::b_length(int nargs) {
 	Datum d = g_lingo->pop();
+	if (d.type == INT || d.type == FLOAT) {
+		g_lingo->push(0);
+		return;
+	}
 	TYPECHECK(d, STRING);
 
 	Common::U32String src = d.asString().decode(Common::kUtf8);
@@ -495,7 +498,15 @@ void LB::b_length(int nargs) {
 }
 
 void LB::b_numToChar(int nargs) {
-	int num = g_lingo->pop().asInt();
+	Datum d = g_lingo->pop();
+	if (g_director->getVersion() < 400) {
+		TYPECHECK(d, INT);
+	} else {
+		warning("BUILDBOT: b_numToChar: Unimplemented behaviour for arg of type %s", (d).type2str());
+		return;
+	}
+
+	int num = d.asInt();
 	g_lingo->push(Common::U32String(numToChar(num)).encode(Common::kUtf8));
 }
 


Commit: 07b6879ccc9971d3408813a0c57490c1e34cfb76
    https://github.com/scummvm/scummvm/commit/07b6879ccc9971d3408813a0c57490c1e34cfb76
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2022-09-29T12:20:40+02:00

Commit Message:
DIRECTOR: Add test in the.lingo for length of integer

Changed paths:
    engines/director/lingo/tests/the.lingo


diff --git a/engines/director/lingo/tests/the.lingo b/engines/director/lingo/tests/the.lingo
index 4fcac6ab288..4a8f8389908 100644
--- a/engines/director/lingo/tests/the.lingo
+++ b/engines/director/lingo/tests/the.lingo
@@ -68,6 +68,7 @@ set h to "Hello"
 
 set gMarkerName = the length of h + 2
 
+scummvmAssertEqual(0, the length of 123)
 
 -- test the itemDelimiter
 set save = the itemDelimiter




More information about the Scummvm-git-logs mailing list