[Scummvm-cvs-logs] SF.net SVN: scummvm:[41477] scummvm/branches/gsoc2009-draci/engines/draci/ gpldisasm.cpp

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Fri Jun 12 13:32:45 CEST 2009


Revision: 41477
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41477&view=rev
Author:   dkasak13
Date:     2009-06-12 11:32:44 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Fixed evaluation of GPL mathematical expressions. The evaluator now checks that, at the end of the evaluation, the stack only contains one value (i.e. the result of the expression).

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/gpldisasm.cpp

Modified: scummvm/branches/gsoc2009-draci/engines/draci/gpldisasm.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/gpldisasm.cpp	2009-06-12 10:39:33 UTC (rev 41476)
+++ scummvm/branches/gsoc2009-draci/engines/draci/gpldisasm.cpp	2009-06-12 11:32:44 UTC (rev 41477)
@@ -160,6 +160,10 @@
 	uint16 value;
 	while (1) {
 		if (obj == kMathEnd) {
+			// Check whether the expression was evaluated correctly
+			// The stack should contain only one value after the evaluation
+			// i.e. the result of the expression
+			assert(stk.size() == 1 && "Mathematical expression error");	
 			break;
 		}
 
@@ -177,6 +181,10 @@
 			value = reader.readUint16LE();
 			stk.pop();
 			stk.pop();
+
+			// FIXME: Pushing dummy value for now, but should push return value
+			stk.push(0);
+
 			debugC(3, kDraciBytecodeDebugLevel, "\t\t-operator %s",
 				operators[value-1].c_str());
 			break;
@@ -189,6 +197,8 @@
 
 		case kMathFunctionCall:
 			value = reader.readUint16LE();
+						
+			stk.pop();
 
 			// FIXME: Pushing dummy value for now, but should push return value
 			stk.push(0);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list