aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-19 15:30:27 +0000
committerMartin Kiewitz2010-07-19 15:30:27 +0000
commitb7b904f9814ca0644a8fea1a3fb9250a4a4fbbd5 (patch)
tree078cf1f2011659a90f6cc5a7091c3465e2928cba
parentcda55fe770ed71f5d4b00690ba4ea196ad4b533f (diff)
downloadscummvm-rg350-b7b904f9814ca0644a8fea1a3fb9250a4a4fbbd5.tar.gz
scummvm-rg350-b7b904f9814ca0644a8fea1a3fb9250a4a4fbbd5.tar.bz2
scummvm-rg350-b7b904f9814ca0644a8fea1a3fb9250a4a4fbbd5.zip
SCI: fix regression of r51027
we have to reset the parser when switching vocabulary svn-id: r51031
-rw-r--r--engines/sci/engine/state.cpp1
-rw-r--r--engines/sci/parser/vocabulary.cpp6
-rw-r--r--engines/sci/parser/vocabulary.h3
-rw-r--r--engines/sci/sci.cpp4
4 files changed, 11 insertions, 3 deletions
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index e07373b466..a069344d61 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -332,6 +332,7 @@ void SciEngine::checkVocabularySwitch() {
if (parserLanguage != _vocabularyLanguage) {
delete _vocabulary;
_vocabulary = new Vocabulary(_resMan, parserLanguage > 1 ? true : false);
+ _vocabulary->reset();
_vocabularyLanguage = parserLanguage;
}
}
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index 82051a3ecd..b4bd4dcb16 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -82,6 +82,12 @@ Vocabulary::~Vocabulary() {
freeSuffixes();
}
+void Vocabulary::reset() {
+ parserIsValid = false; // Invalidate parser
+ parser_event = NULL_REG; // Invalidate parser event
+ parser_base = make_reg(g_sci->getEngineState()->_segMan->getSysStringsSegment(), SYS_STRING_PARSER_BASE);
+}
+
bool Vocabulary::loadParserWords() {
char currentWord[VOCAB_MAX_WORDLENGTH] = "";
int currentWordPos = 0;
diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h
index 80ed68547d..5c8c8fd57d 100644
--- a/engines/sci/parser/vocabulary.h
+++ b/engines/sci/parser/vocabulary.h
@@ -174,6 +174,9 @@ public:
Vocabulary(ResourceManager *resMan, bool foreign);
~Vocabulary();
+ // reset parser status
+ void reset();
+
/**
* Gets any word from the specified group. For debugging only.
* @param group Group number
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 11d1057fff..4b467a7578 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -301,9 +301,7 @@ bool SciEngine::initGame() {
// Reset parser
if (_vocabulary) {
- _vocabulary->parserIsValid = false; // Invalidate parser
- _vocabulary->parser_event = NULL_REG; // Invalidate parser event
- _vocabulary->parser_base = make_reg(_gamestate->_segMan->getSysStringsSegment(), SYS_STRING_PARSER_BASE);
+ _vocabulary->reset();
}
_gamestate->gameStartTime = _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis();