[Scummvm-git-logs] scummvm master -> 5357b8b23c94e3ad6f2d324ba64005fb591f369e

rvanlaar roland at rolandvanlaar.nl
Tue Jul 21 22:19:09 UTC 2020


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:
5357b8b23c DIRECTOR: LINGO: Handle builtin args in range


Commit: 5357b8b23c94e3ad6f2d324ba64005fb591f369e
    https://github.com/scummvm/scummvm/commit/5357b8b23c94e3ad6f2d324ba64005fb591f369e
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2020-07-22T00:18:52+02:00

Commit Message:
DIRECTOR: LINGO: Handle builtin args in range

Builtins can have a range of arguments. For example
`unLoadCast` can have 0, 1 or 2 arguments, defined as 0, 2.
Calling such functions only allowed for the min and max number
of arguments (nargs). This fixes that by checking if the nargs
is either smaller than the minimum or larger than the maximum.

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


diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index b7c137a88f..1de43645fc 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1432,7 +1432,7 @@ void LC::call(const Symbol &funcSym, int nargs) {
 		warning("Call to undefined handler. Dropping %d stack items", nargs);
 		dropArgs = true;
 	} else {
-		if (funcSym.type != HANDLER && funcSym.nargs != -1 && funcSym.nargs != nargs && funcSym.maxArgs != nargs) {
+		if (funcSym.type != HANDLER && funcSym.nargs != -1 && (funcSym.nargs > nargs || funcSym.maxArgs < nargs)) {
 			if (funcSym.nargs == funcSym.maxArgs)
 				warning("Incorrect number of arguments to handler '%s', expecting %d. Dropping %d stack items", funcSym.name->c_str(), funcSym.nargs, nargs);
 			else




More information about the Scummvm-git-logs mailing list