Make character load if exists in sim.js

This commit is contained in:
Eric Fredricksen
2011-12-02 14:36:17 -08:00
parent 23fb0b4ba5
commit ead5a61dc7
2 changed files with 17 additions and 13 deletions
+2 -2
View File
@@ -996,7 +996,7 @@ function pause(msec) {
function quit() {
$(window).unbind('unload');
SaveGame(function () { window.location = "roster.html"; });
SaveGame(function () { window.location.href = "roster.html"; });
}
@@ -1037,7 +1037,7 @@ function SaveGame(callback) {
function LoadGame(sheet) {
if (!sheet) {
alert("Error loading game");
window.location = "roster.html";
window.location.href = "roster.html";
return;
}
+15 -11
View File
@@ -11,6 +11,9 @@
// It's not realtime - simulation runs at maximum speed and the
// virtual time elapsed is displayed at each level-up.
var CHARACTER = "Shienzid";
//var guy = window.location.href.split("#")[1];
var window = {
location: {href: "#Woogle"},
@@ -117,21 +120,12 @@ var cs = 0;
storage.loadRoster(function (cs) { for (var c in cs) cs++; });
print(cs, "characters");
load("newguy.js");
NewGuyFormLoad();
traits.Name = "Shienzid";
sold();
write("local.storage", JSON.stringify(window.localStorage.items));
var guy = window.location.href.split("#")[1];
load("main.js");
var timeGetTime = global.timeGetTime = function () {
return now;
}
load("main.js");
FormCreate();
function charsheet(game) {
@@ -151,8 +145,18 @@ for (var j = 1, t = 0; j < 1001; ++j) {
}
var tmpl = read("charsheet.txt");
storage.loadSheet("Shienzid", function (sheet) {
storage.loadSheet(CHARACTER, function (sheet) {
if (!sheet) {
load("newguy.js");
NewGuyFormLoad();
traits.Name = CHARACTER;
sold();
sheet = storage.games[CHARACTER];
}
//write("local.storage", JSON.stringify(window.localStorage.items));
game = sheet;
LoadGame(game);
print(template(''+tmpl, sheet));
var l = 0;