From 41ba2433f57f064f3119b5b5c1247eadb32d5977 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 6 Jan 2012 09:38:41 +0100 Subject: [PATCH] AGI: Fix predictive input binary search Note that there are still issues with this input mode. If the binary search hits a prefix match before finding the full match, it won't recognize the full match. (Example: typing "buy" will show "buz" because it's aiming for "buzzard" without realizing "buy" exists.) --- engines/agi/predictive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 3290068d5a3..56d9190e7fb 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -570,7 +570,7 @@ bool AgiEngine::matchWord() { int hi = _predictiveDictLineCount - 1; int lo = 0; int line = 0; - while (lo < hi) { + while (lo <= hi) { line = (lo + hi) / 2; int cmpVal = strncmp(_predictiveDictLine[line], _currentCode.c_str(), _currentCode.size()); if (cmpVal > 0)