aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/parallaction.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2007-08-16 19:47:22 +0000
committerNicola Mettifogo2007-08-16 19:47:22 +0000
commiteb0798d58095abab2dee11206440c3c2d5e204cd (patch)
tree4f5ae4f83394eff91604a9b9427f68321dfa7c3c /engines/parallaction/parallaction.cpp
parent47b2f533f0a5e2e70759b90f798c66d3b763a0d9 (diff)
downloadscummvm-rg350-eb0798d58095abab2dee11206440c3c2d5e204cd.tar.gz
scummvm-rg350-eb0798d58095abab2dee11206440c3c2d5e204cd.tar.bz2
scummvm-rg350-eb0798d58095abab2dee11206440c3c2d5e204cd.zip
Now using stacks to keep track of multiple levels when parsing location scripts.
svn-id: r28639
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r--engines/parallaction/parallaction.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index b2893ebfca..af0a34e409 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -849,6 +849,30 @@ int Table::lookup(const char* s) {
return notFound;
}
+void Parallaction::pushParserTables(const Opcode* opcodes, Table *statements) {
+
+ _opcodes.push(_currentOpcodes);
+ _statements.push(_currentStatements);
+
+ _currentOpcodes = opcodes;
+ _currentStatements = statements;
+
+}
+
+void Parallaction::popParserTables() {
+ assert(_opcodes.size() > 0);
+
+ _currentOpcodes = _opcodes.pop();
+ _currentStatements = _statements.pop();
+}
+
+void Parallaction::parseStatement() {
+ assert(_currentOpcodes != 0);
+
+ _lookup = _currentStatements->lookup(_tokens[0]);
+ (this->*(_currentOpcodes[_lookup]))();
+}
+
void Parallaction::initOpcodes() {
static const Opcode op0[] = {
@@ -998,6 +1022,9 @@ void Parallaction::initOpcodes() {
_locationAnimParsers = op6;
+ _currentOpcodes = 0;
+ _currentStatements = 0;
+
}
} // namespace Parallaction