aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}