diff options
author | uruk | 2013-08-25 17:10:29 +0200 |
---|---|---|
committer | uruk | 2013-08-25 17:10:29 +0200 |
commit | f729e9e84893e2da9803a9b1ae2210d42db449f8 (patch) | |
tree | 8726e06096013c89a2b8859d99dc7dff04ccd476 | |
parent | f4824986ecbd45ceb720ecf54a085d02429acd98 (diff) | |
download | scummvm-rg350-f729e9e84893e2da9803a9b1ae2210d42db449f8.tar.gz scummvm-rg350-f729e9e84893e2da9803a9b1ae2210d42db449f8.tar.bz2 scummvm-rg350-f729e9e84893e2da9803a9b1ae2210d42db449f8.zip |
AVALANCHE: Repair Acci::wordnum().
-rw-r--r-- | engines/avalanche/acci2.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 5cfafd1ad4..74a74b7171 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -238,7 +238,12 @@ byte Acci::wordnum(Common::String x) { return 0; for (int32 fv = nowords - 1; fv >= 0; fv--) - if ((words[fv].w == x) || (Common::String(words[fv].w.c_str(), x.size()) == x)) + if (words[fv].w == x) + return words[fv].n; + + // If not found as a whole, we look for it as a substring. + for (int32 fv = nowords - 1; fv >= 0; fv--) + if (Common::String(words[fv].w.c_str(), x.size()) == x) return words[fv].n; return pardon; @@ -561,7 +566,7 @@ void Acci::parse() { fv++; } - if (_vm->_gyro->subjnumber == 0) // Still not found. + if ((_vm->_gyro->subjnumber == 0) && !thats.empty()) // Still not found. for (fv = 0; fv < thats.size() - 1; fv++) if ((byte)thats[fv] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = (byte)thats[fv + 1]; @@ -569,7 +574,7 @@ void Acci::parse() { break; } - if (_vm->_gyro->subjnumber == 0) // STILL not found! Must be the word after "say". + if ((_vm->_gyro->subjnumber == 0) && !thats.empty())// STILL not found! Must be the word after "say". for (fv = 0; fv < thats.size() - 1; fv++) if (((byte)thats[fv] == 7) && ((byte)thats[fv + 1] != 0) && !((225 <= (byte)thats[fv + 1]) && ((byte)thats[fv + 1] <= 229))) { // SAY not followed by a preposition |