aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-11 09:53:47 +0100
committerEugene Sandulenko2017-02-11 09:53:47 +0100
commit8420310989cd52627c95ee6966bbe46f99626239 (patch)
tree75b87f8b4d8d5717345b14e0dc5378bfb359f1d0 /engines/director/lingo
parent4e5952c7748e4540b7e563183b143ec506eacb00 (diff)
downloadscummvm-rg350-8420310989cd52627c95ee6966bbe46f99626239.tar.gz
scummvm-rg350-8420310989cd52627c95ee6966bbe46f99626239.tar.bz2
scummvm-rg350-8420310989cd52627c95ee6966bbe46f99626239.zip
DIRECTOR: Lingo: Implemented sanity checks for built-ins
Diffstat (limited to 'engines/director/lingo')
-rw-r--r--engines/director/lingo/lingo-code.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index b79e51dcde..ee32cf06e5 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1063,11 +1063,24 @@ void Lingo::call(Common::String name, int nargs) {
}
if (sym->type == BLTIN || sym->type == FBLTIN) {
- if (sym->u.bltin == b_factory)
+ if (sym->u.bltin == b_factory) {
g_lingo->factoryCall(name, nargs);
- else
+ } else {
+ int stackSize = _stack.size() - nargs;
+
(*sym->u.bltin)(nargs);
+ int stackNewSize = _stack.size();
+
+ if (sym->type == FBLTIN) {
+ if (stackNewSize - stackSize != 1)
+ warning("built-in function %s did not return value", name.c_str());
+ } else {
+ if (stackNewSize - stackSize != 0)
+ warning("built-in procedure %s returned extra %d values", name.c_str(), stackNewSize - stackSize);
+ }
+ }
+
return;
}