GLK: ADVSYS: Fix actions using OP_SEND

This commit is contained in:
Paul Gilbert 2019-06-16 17:04:53 -07:00
parent c7a9306415
commit 0bf2dc6d7b
3 changed files with 9 additions and 2 deletions

View File

@ -83,6 +83,7 @@ void AdvSys::deinitialize() {
}
bool AdvSys::singleAction() {
debug("------------------");
// Do the before code
switch (execute(_beforeOffset)) {
case ABORT:

View File

@ -93,6 +93,7 @@ ExecutionResult VM::execute(int offset) {
_pc = offset;
// Clear the stack
_fp.clear();
_stack.clear();
// Iterate through the script
@ -398,9 +399,9 @@ void VM::opSEND() {
if (val)
val = getObjectField(val, O_CLASS);
else
val = _fp[_fp[FP_ARGS_SIZE] + FP_ARGS];
val = _fp[_fp[FP_ARGS_SIZE] + FP_ARGS - 1];
if (val && (val = getObjectProperty(val, _fp[_fp[FP_ARGS_SIZE] + 1])) != 0) {
if (val && (val = getObjectProperty(val, _fp[_fp[FP_ARGS_SIZE] + FP_ARGS - 2])) != 0) {
_pc = getActionField(val, A_CODE);
} else {
// Return NIL if there's no action for the given message

View File

@ -180,6 +180,11 @@ public:
return *this;
}
/**
* Clear the function pointer
*/
void clear() { _index = 0; }
/**
* Returns the index in the stack of the function pointer
*/