Skip to content

Commit

Permalink
DIRECTOR: Lingo: Implement calling user-defined functions without par…
Browse files Browse the repository at this point in the history
…ameters
  • Loading branch information
sev- committed Aug 3, 2016
1 parent a910fe2 commit c48f1b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion engines/director/director.cpp
Expand Up @@ -102,7 +102,7 @@ if par1 = 3 then\n\
else\n\
put 9\n\
end if\n\
\n\
shipx\n\
", kMovieScript, 1);

return Common::kNoError;
Expand Down
16 changes: 12 additions & 4 deletions engines/director/lingo/lingo-code.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit c48f1b5

Please sign in to comment.