AGI: Skip words starting with digits that are filed under 'a' in the dictionary.

The fan game SQ0 does this (for '7up', among others), and this caused us
to skip all words starting with an 'a'. Bug #3615061.
This commit is contained in:
Willem Jan Palenstijn 2013-10-01 19:58:51 +02:00
parent 574a2a64fe
commit b1a7492da8

View File

@ -93,14 +93,25 @@ int AgiEngine::loadWords(const char *fname) {
} while (!(c & 0x80) && k < (int)sizeof(str) - 1);
str[k] = 0;
// And store it in our internal dictionary
AgiWord *w = new AgiWord;
w->word = myStrndup(str, k);
w->id = fp.readUint16BE();
_game.words[i].push_back(w);
// WORKAROUND:
// The SQ0 fan game stores words starting with numbers (like '7up')
// in its dictionary under the 'a' entry. We skip these.
// See bug #3615061
if (str[0] == 'a' + i) {
// And store it in our internal dictionary
AgiWord *w = new AgiWord;
w->word = myStrndup(str, k);
w->id = fp.readUint16BE();
_game.words[i].push_back(w);
}
k = fp.readByte();
// Are there more words with an already known prefix?
if (!(k = fp.readByte()))
// WORKAROUND: We only break after already seeing words with the
// right prefix, for the SQ0 words starting with digits filed under
// 'a'. See above comment and bug #3615061.
if (k == 0 && str[0] >= 'a' + i)
break;
}
}