diff options
author | Travis Howell | 2007-04-15 14:32:58 +0000 |
---|---|---|
committer | Travis Howell | 2007-04-15 14:32:58 +0000 |
commit | 5668e15b2efb2aa9ab5bff3cf6b257a3986602ff (patch) | |
tree | e47d59fbd63748a1bc16b7b2190baf29ec744663 /engines/agos/script.cpp | |
parent | 7fad7c6f3f40540c933a022c144bbe5187006f01 (diff) | |
download | scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.tar.gz scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.tar.bz2 scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.zip |
Update reporting of invalid script opcodes.
svn-id: r26501
Diffstat (limited to 'engines/agos/script.cpp')
-rw-r--r-- | engines/agos/script.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index 3ba88524d9..ecc43038c1 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -61,8 +61,7 @@ int AGOSEngine::getScriptReturn() { // ----------------------------------------------------------------------- void AGOSEngine::o_invalid() { - // TODO: Better error reporting - error("Invalid opcode"); + error("Invalid opcode %d", _opcode); } void AGOSEngine::o_at() { @@ -883,7 +882,6 @@ void AGOSEngine::writeVariable(uint variable, uint16 contents) { } int AGOSEngine::runScript() { - int opcode; bool flag; do { @@ -891,12 +889,12 @@ int AGOSEngine::runScript() { dumpOpcode(_codePtr); if (getGameType() == GType_ELVIRA1) { - opcode = getVarOrWord(); - if (opcode == 10000) + _opcode = getVarOrWord(); + if (_opcode == 10000) return 0; } else { - opcode = getByte(); - if (opcode == 0xFF) + _opcode = getByte(); + if (_opcode == 0xFF) return 0; } @@ -906,17 +904,17 @@ int AGOSEngine::runScript() { /* Invert condition? */ flag = false; if (getGameType() == GType_ELVIRA1) { - if (opcode == 203) { + if (_opcode == 203) { flag = true; - opcode = getVarOrWord(); - if (opcode == 10000) + _opcode = getVarOrWord(); + if (_opcode == 10000) return 0; } } else { - if (opcode == 0) { + if (_opcode == 0) { flag = true; - opcode = getByte(); - if (opcode == 0xFF) + _opcode = getByte(); + if (_opcode == 0xFF) return 0; } } @@ -924,10 +922,10 @@ int AGOSEngine::runScript() { setScriptCondition(true); setScriptReturn(0); - if (opcode > _numOpcodes) - error("Invalid opcode '%d' encountered", opcode); + if (_opcode > _numOpcodes) + error("Invalid opcode '%d' encountered", _opcode); - executeOpcode(opcode); + executeOpcode(_opcode); } while (getScriptCondition() != flag && !getScriptReturn()); return getScriptReturn(); |