[Scummvm-cvs-logs] scummvm master -> ad83f033151ac6cf6345e6a83a0903ad6499c0ca

eriktorbjorn eriktorbjorn at telia.com
Tue Jan 20 19:28:04 CET 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ad83f03315 ZVISION: Fix mis-parsing of criteria, a.k.a bug #6774


Commit: ad83f033151ac6cf6345e6a83a0903ad6499c0ca
    https://github.com/scummvm/scummvm/commit/ad83f033151ac6cf6345e6a83a0903ad6499c0ca
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-01-20T19:21:39+01:00

Commit Message:
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.

Changed paths:
    engines/zvision/scripting/scr_file_handling.cpp



diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp
index 277702d..8f0f80e 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;






More information about the Scummvm-git-logs mailing list