diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2012-12-02 13:27:12 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2012-12-02 13:27:12 -0800 |
commit | b2bffd5eb17212b60b62ab86a8559213ed3820af (patch) | |
tree | 82a83c206ff6fa2f9f40eccde47064af1c6d9115 /js | |
parent | 1399d45c68e7d14fc1f3e8f2b5451669cce4ffa4 (diff) | |
download | pathery-b2bffd5eb17212b60b62ab86a8559213ed3820af.tar.xz |
Image updates and mapspecs fixes.
Fixed a bug where every checkpoint was called "checkpoint A"
Fixed a bug where requesting solution during a path would break it.
Fixed a bug regarding tutorial success.
Diffstat (limited to 'js')
-rw-r--r-- | js/mapspecs.js | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index 5299b60..5a64d83 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -33,11 +33,6 @@ var mapType; // 1 = simple, 2 = normal, ...; used for mixpanel tracking var pressedGoTime = 0;
-// function loadAllSolutions() {
- // for(var i in jsonmapdata.solutions) {
- // }
-// }
-
function loadSol(sol, moves) {
if (sol == null)
if (document.getElementById('mapsol') != undefined)
@@ -62,7 +57,6 @@ function loadSol(sol, moves) { if (moves && mapid) {
updateDsp(mapid, 'dspCount', moves+ " moves");
}
-
}
function showNotification(html) {
@@ -163,20 +157,12 @@ function updateDsp(mapid, element, data) { }
function getmapdata(mapid) {
- var rawjson = jsonmapdata[mapid];
- if (typeof(JSON) == 'undefined') {
- //text = document.getElementById(mapid+',mapdata').innerHTML;
- text = rawjson;
- mapdata[mapid] = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
- //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML);
- } else {
- //mapdata[mapid] = JSON.parse(document.getElementById(mapid+',mapdata').innerHTML);
- mapdata[mapid] = JSON.parse(rawjson);
- }
-
+
+ if (typeof(mapdata[mapid]) != 'object')
+ mapdata[mapid] = decryptJSON(jsonmapdata[mapid]);
+
blocks[mapid] = mapdata[mapid].walls;
solution[mapid] = '.';
-
updateDsp(mapid, 'dspWalls', blocks[mapid]+" walls");
}
@@ -206,15 +192,10 @@ function requestSol(mapID) { function requestSolDone() {
var JO;
- if (typeof(JSON) == 'undefined') {
- text = ajax.response;
- JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
- } else {
- JO = JSON.parse(ajax.response);
- }
+ JO = decryptJSON(ajax.response);
if (JO.solution == 'undefined')
return;
- clearwalls(JO.mapid);
+ //clearwalls(JO.mapid);
loadSol(JO.mapid + ":" + JO.solution, JO.moves);
}
@@ -242,7 +223,8 @@ function clearwalls(mapid) { }
}
solution[mapid] = undefined;
- getmapdata(mapid);
+ //!!
+ //getmapdata(mapid);
}
function resetwalls(mapid) {
@@ -253,7 +235,6 @@ function resetwalls(mapid) { }
function request_path_done() {
-
var JO = decryptJSON(ajax.response);
var mapid = JO.mapid;
mapjson[mapid] = JO;
@@ -289,7 +270,6 @@ function request_path_done() { mapdata[mapid].restoreTiles = new Array();
mapdata[mapid].pathColor = new Object;
-
mapdata[mapid].pathsPending = JO.path.length;
mapdata[mapid].isMultiPath = (JO.path.length > 1);
@@ -299,8 +279,6 @@ function request_path_done() { animatePath(JO.path[i].path, mapid, JO.path[i].start, i);
}
-
-
//Mark off challenges
//TODO: Temporarly disabled because it breaks the tutorial;
if(isChallenge && 2 == 4)
@@ -318,9 +296,8 @@ function decryptJSON(text) { var JO;
if (typeof(JSON) == 'undefined') {
JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
- //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML);
} else {
- JO = JSON.parse(ajax.response);
+ JO = JSON.parse(text);
}
return JO;
}
@@ -341,9 +318,6 @@ function animatePath(path, mapid, start, pathNumber) { }
function animatePathDone(mapid) {
-
- //console.log('Animate Path Done', mapid);
-
scoresRequestPage(mapid, currentPage[mapid]);
document.getElementById(mapid+',btn').disabled = false;
if (isChallenge == true) {
|