DIRECTOR: Lingo: Fix factory method execution
This commit is contained in:
parent
9517c39397
commit
ec23290df1
2 changed files with 12 additions and 1 deletions
|
@ -183,6 +183,14 @@ void Lingo::dropStack(int nargs) {
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lingo::drop(int num) {
|
||||||
|
if (num > _stack.size() - 1) {
|
||||||
|
warning("Incorrect number of elements to drop from stack: %d > %d", num, _stack.size() - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_stack.remove_at(_stack.size() - 1 - num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Math
|
// Math
|
||||||
|
@ -794,9 +802,11 @@ void Lingo::factoryCall(Common::String &name, int nargs) {
|
||||||
|
|
||||||
Datum method = _stack[_stack.size() - nargs + 0];
|
Datum method = _stack[_stack.size() - nargs + 0];
|
||||||
|
|
||||||
|
drop(nargs - 1);
|
||||||
|
|
||||||
s = name + "-" + *method.u.s;
|
s = name + "-" + *method.u.s;
|
||||||
|
|
||||||
debugC(3, kDebugLingoExec, "Stack size before call: %d", _stack.size());
|
debugC(3, kDebugLingoExec, "Stack size before call: %d, nargs: %d", _stack.size(), nargs);
|
||||||
call(s, nargs);
|
call(s, nargs);
|
||||||
debugC(3, kDebugLingoExec, "Stack size after call: %d", _stack.size());
|
debugC(3, kDebugLingoExec, "Stack size after call: %d", _stack.size());
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,7 @@ public:
|
||||||
void printStubWithArglist(const char *funcname, int nargs);
|
void printStubWithArglist(const char *funcname, int nargs);
|
||||||
void convertVOIDtoString(int arg, int nargs);
|
void convertVOIDtoString(int arg, int nargs);
|
||||||
void dropStack(int nargs);
|
void dropStack(int nargs);
|
||||||
|
void drop(int num);
|
||||||
|
|
||||||
static void b_abs(int nargs);
|
static void b_abs(int nargs);
|
||||||
static void b_atan(int nargs);
|
static void b_atan(int nargs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue