[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.116,1.117

Max Horn fingolfin at users.sourceforge.net
Wed Jun 25 13:17:17 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv9851

Modified Files:
	script.cpp 
Log Message:
cleanup

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- script.cpp	16 Jun 2003 11:37:08 -0000	1.116
+++ script.cpp	25 Jun 2003 20:16:47 -0000	1.117
@@ -323,26 +323,29 @@
 		nest->number = 0xFF;
 		nest->where = 0xFF;
 	} else {
+		// Store information about the currently running script
 		slot = &vm.slot[_currentScript];
 		nest->number = slot->number;
 		nest->where = slot->where;
 		nest->slot = _currentScript;
 	}
 
-	if (++_numNestedScripts > ARRAYSIZE(vm.nest))
+	_numNestedScripts++;
+	
+	if (_numNestedScripts > ARRAYSIZE(vm.nest))
 		error("Too many nested scripts");
 
 	_currentScript = script;
-
 	getScriptBaseAddress();
 	getScriptEntryPoint();
 	executeScript();
 
 	_numNestedScripts--;
 
-	nest = &vm.nest[_numNestedScripts];
-
 	if (nest->number != 0xFF) {
+		// Try to resume the script which called us, if its status has not changed
+		// since it invoked us. In particular, we only resume it if it hasn't been
+		// stopped in the meantime, and if it did not already move on.
 		slot = &vm.slot[nest->slot];
 		if (slot->number == nest->number && slot->where == nest->where &&
 				slot->status != ssDead && slot->freezeCount == 0) {





More information about the Scummvm-git-logs mailing list