aboutsummaryrefslogtreecommitdiff
path: root/kyra/script_v1.cpp
diff options
context:
space:
mode:
authorGregory Montoir2004-11-10 18:45:32 +0000
committerGregory Montoir2004-11-10 18:45:32 +0000
commitc50560a48813ba237878af4f47854bd3bc8751b3 (patch)
tree8af2f79fa84415c1928dd499c249180bf47e1614 /kyra/script_v1.cpp
parent507d02d8d224a91fadec6914136c657a56e945fe (diff)
downloadscummvm-rg350-c50560a48813ba237878af4f47854bd3bc8751b3.tar.gz
scummvm-rg350-c50560a48813ba237878af4f47854bd3bc8751b3.tar.bz2
scummvm-rg350-c50560a48813ba237878af4f47854bd3bc8751b3.zip
Clean up a bit the script stuff. In particular, resized the command pointers array, as it seems that none of kyrandia games have more than 0x13 command opcodes (checked kyra2 and kyra3).
svn-id: r15782
Diffstat (limited to 'kyra/script_v1.cpp')
-rw-r--r--kyra/script_v1.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp
index 753d9484a3..ec9030d628 100644
--- a/kyra/script_v1.cpp
+++ b/kyra/script_v1.cpp
@@ -103,8 +103,12 @@ namespace Kyra {
}
void VMContext::c1_execOpcode(void) {
- OpcodeProc proc = _opcodes[_argument].proc;
- (this->*proc)();
+ if (_argument < _numOpcodes) {
+ OpcodeProc proc = _opcodes[_argument].proc;
+ (this->*proc)();
+ } else {
+ error("Invalid opcode 0x%X", _argument);
+ }
}
void VMContext::c1_ifNotGoTo(void) {