changeset 89:0e1eb40ac12b

Fixed a bug that prevented games from being able to restart themselves.
author Atul Varma <varmaa@toolness.com>
date Thu, 22 May 2008 00:23:20 -0700
parents f8d853a77c52
children 051e1dcf071f
files web-zui.js
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/web-zui.js	Thu May 22 00:00:14 2008 -0700
+++ b/web-zui.js	Thu May 22 00:23:20 2008 -0700
@@ -469,17 +469,17 @@
 
 function _zcodeLoaded(status, data) {
   if (status == "success") {
-    var zcode = new Array(data.length);
+    gZcode = new Array(data.length);
     for (var i = 0; i < data.length; i++) {
-      zcode[i] = data.charCodeAt(i) & 0xff;
+      gZcode[i] = data.charCodeAt(i) & 0xff;
     }
-    _webZuiStartup(zcode);
+    _webZuiStartup();
   } else {
     throw new Error("Error occurred when retrieving z-code: " + data);
   }
 }
 
-function _webZuiStartup(zcode) {
+function _webZuiStartup() {
   var logfunc = undefined;
 
   if (window.console) {
@@ -490,13 +490,14 @@
   var zui = new WebZui(logfunc);
   var runner = new EngineRunner(engine, zui, logfunc);
 
-  engine.loadStory(zcode.slice());
+  engine.loadStory(gZcode.slice());
   runner.run();
 }
 
 var gThisUrl = location.protocol + "//" + location.host + location.pathname;
 var gBaseUrl = gThisUrl.slice(0, gThisUrl.lastIndexOf("/"));
 var gStory = "";
+var gZcode = null;
 var IF_ARCHIVE_PREFIX = "if-archive/";
 
 $(document).ready(function() {