diff options
author | Filippos Karapetis | 2011-10-16 01:10:32 +0300 |
---|---|---|
committer | Filippos Karapetis | 2011-10-16 01:11:15 +0300 |
commit | 69c705a0199f2526f2df774e1b2ee5cddaa63f6c (patch) | |
tree | a45845522264872b00d24d63bbb8a64298fc5464 /engines | |
parent | ca88b03828e0f00ae22dac2e2d9edebfed99ba90 (diff) | |
download | scummvm-rg350-69c705a0199f2526f2df774e1b2ee5cddaa63f6c.tar.gz scummvm-rg350-69c705a0199f2526f2df774e1b2ee5cddaa63f6c.tar.bz2 scummvm-rg350-69c705a0199f2526f2df774e1b2ee5cddaa63f6c.zip |
AGI: Fixed bug #3424066 - "LSL1 AGI: Password Glitch"
We should not stop looking when a partial sentence match is found, as a
better match might exist later on. In this case, there were two matching
sentences, "Ken" (which is wrong in this case) and "Ken sent me" (which
is correct, but was never reached as the partial match was returned
first)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/words.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index ec6928f8ed..f6e399245a 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -120,6 +120,7 @@ void AgiEngine::unloadWords() { */ int AgiEngine::findWord(const char *word, int *flen) { int c; + int result = -1; debugC(2, kDebugLevelScripts, "find_word(%s)", word); @@ -130,15 +131,17 @@ int AgiEngine::findWord(const char *word, int *flen) { *flen = 0; Common::Array<AgiWord*> &a = _game.words[c]; + for (int i = 0; i < (int)a.size(); i++) { int wlen = strlen(a[i]->word); + // Keep looking till we find the word itself, or the whole phrase if (!strncmp(a[i]->word, word, wlen) && (word[wlen] == 0 || word[wlen] == 0x20)) { *flen = wlen; - return a[i]->id; + result = a[i]->id; } } - return -1; + return result; } void AgiEngine::dictionaryWords(char *msg) { |