From 9828447be4dc9ed7203312aac26fd8a9e2cd8b35 Mon Sep 17 00:00:00 2001 From: antoniou79 Date: Thu, 29 Feb 2024 16:20:11 +0200 Subject: [PATCH] AGI: Fix missing words from our dictionary 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. --- engines/agi/words.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index c7b0320345dc..cbb75b253ec6 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -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(); @@ -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; @@ -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();