aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-code.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-06-25 16:38:31 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitc48f1b5756368f5c30c706c1861eac1d63b1ef22 (patch)
treea94c50b104efff84999ecafdb5517796163b7165 /engines/director/lingo/lingo-code.cpp
parenta910fe22dbe5452acf8ad75ef5c66162c77f7733 (diff)
downloadscummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.tar.gz
scummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.tar.bz2
scummvm-rg350-c48f1b5756368f5c30c706c1861eac1d63b1ef22.zip
DIRECTOR: Lingo: Implement calling user-defined functions without parameters
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r--engines/director/lingo/lingo-code.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index cc5777a50d..d7cbe8108d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -408,11 +408,19 @@ int Lingo::codeId(Common::String &s) {
return g_lingo->codeId_(s);
}
-int Lingo::codeId_(Common::String &s) {
- int ret = code1(c_varpush);
+int Lingo::codeId_(Common::String &name) {
+ int ret;
- codeString(s.c_str());
- code1(c_eval);
+ if (!_handlers.contains(name)) { // This is a call
+ ret = code1(c_call);
+ codeString(name.c_str());
+ code1((inst)0); // Zero arguments
+ } else {
+ ret = code1(c_varpush);
+
+ codeString(name.c_str());
+ code1(c_eval);
+ }
return ret;
}