aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/scripting
diff options
context:
space:
mode:
authorTorbjörn Andersson2015-01-20 19:21:39 +0100
committerTorbjörn Andersson2015-01-20 19:21:39 +0100
commitad83f033151ac6cf6345e6a83a0903ad6499c0ca (patch)
tree418898387f1ec0bd8cf1f3456b86fd7adb688c92 /engines/zvision/scripting
parent750d72812b36bfed3043080d633798854dc4008d (diff)
downloadscummvm-rg350-ad83f033151ac6cf6345e6a83a0903ad6499c0ca.tar.gz
scummvm-rg350-ad83f033151ac6cf6345e6a83a0903ad6499c0ca.tar.bz2
scummvm-rg350-ad83f033151ac6cf6345e6a83a0903ad6499c0ca.zip
ZVISION: Fix mis-parsing of criteria, a.k.a bug #6774
A condition in a criteria is made up of three tokens: An id, an operator and an id/value. However, in my copy of ZGI, puzzle:07507 has "[00202] !3 # SPELL_12_IN_BOOK", i.e. there was no space between the second and third tokens. This caused the "glorf" spell to not be properly inscribed in your spell book. To fix this, if the second token is more than one character we use the rest of it as the third token.
Diffstat (limited to 'engines/zvision/scripting')
-rw-r--r--engines/zvision/scripting/scr_file_handling.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp
index 277702d287..8f0f80e39e 100644
--- a/engines/zvision/scripting/scr_file_handling.cpp
+++ b/engines/zvision/scripting/scr_file_handling.cpp
@@ -141,9 +141,17 @@ bool ScriptManager::parseCriteria(Common::SeekableReadStream &stream, Common::Li
else if (token.c_str()[0] == '<')
entry.criteriaOperator = Puzzle::LESS_THAN;
+ // There are supposed to be three tokens, but there is no
+ // guarantee that there will be a space between the second and
+ // the third one (bug #6774)
+ if (token.size() == 1) {
+ token = tokenizer.nextToken();
+ } else {
+ token.deleteChar(0);
+ }
+
// First determine if the last token is an id or a value
// Then parse it into 'argument'
- token = tokenizer.nextToken();
if (token.contains('[')) {
sscanf(token.c_str(), "[%u]", &(entry.argument));
entry.argumentIsAKey = true;