Skip to content

Commit

Permalink
AGI: Fix missing words from our dictionary
Browse files Browse the repository at this point in the history
This fixes bug #15000 "V Demo does not recognize valid word ammunition"

Our code was actually not parsing correctly many (all?) words starting with "a" in this particular game.
  • Loading branch information
antoniou79 authored and sluicebox committed Mar 1, 2024
1 parent 634d29f commit 9828447
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engines/agi/words.cpp
Expand Up @@ -80,6 +80,8 @@ int Words::loadDictionary(const char *fname) {

// Loop through alphabet, as words in the dictionary file are sorted by
// first character
char str[64] = { 0 };
char c;
for (int i = 0; i < 26; i++) {
fp.seek(i * 2, SEEK_SET);
int offset = fp.readUint16BE();
Expand All @@ -89,7 +91,6 @@ int Words::loadDictionary(const char *fname) {
int k = fp.readByte();
while (!fp.eos() && !fp.err()) {
// Read next word
char c, str[64];
do {
c = fp.readByte();
str[k++] = (c ^ 0x7F) & 0x7F;
Expand All @@ -106,6 +107,8 @@ int Words::loadDictionary(const char *fname) {
newWord->word = Common::String(str, k);
newWord->id = fp.readUint16BE();
_dictionaryWords[i].push_back(newWord);
} else {
fp.readUint16BE();
}

k = fp.readByte();
Expand Down

0 comments on commit 9828447

Please sign in to comment.