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)
This commit is contained in:
parent
ca88b03828
commit
69c705a019
1 changed files with 5 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue