summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-03-05 14:17:08 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-03-05 14:17:08 -0800
commit677b7454a37a0152f50d40993460d8f5a071e181 (patch)
treedc664e700b4aa4d0c1ab54ff7c99798dd9b623da /js
parentd1209f8d15c83a1d8d29beafc085d927be7d2bcd (diff)
downloadpathery-677b7454a37a0152f50d40993460d8f5a071e181.tar.xz
Map editor 0.1!
Diffstat (limited to 'js')
-rw-r--r--js/mapspecs.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js
index 2387a00..443ddfe 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -92,6 +92,12 @@ function grid_click(obj) {
y = tmp[1];
x = tmp[2];
+
+ if(mapdata[mapid].editMap == true) {
+ mapClick(obj);
+ return;
+ }
+
//The users solution - prepare it if it's not started
if (solution[mapid] == undefined) {
getmapdata(mapid);
@@ -838,7 +844,7 @@ var Tile = {
"x" : "Single-Path-Rock"};
//Map as object. If target width is NULL or False, default width is used.
-function mapAsHTML(map, targetWidth, demo) {
+function mapAsHTML(map, targetWidth, mapEditor) {
map.mapid = map.ID;
//console.log("MapID:", map.mapid);
@@ -872,9 +878,9 @@ function mapAsHTML(map, targetWidth, demo) {
// GOAL WOULD BE THIS LINE INSTEAD.. As it's not retarded.
//var idHandle = map.ID+','+x+','+y;
-
+
//oldy is used for Position too... for now
- if (type == 'o') {
+ if (type == 'o' || mapEditor == true) {
mapgrid += "<div style='float:left; width:"+tileWidth+"px; height:"+tileWidth+"px; ' class='mapcell "+type+value+"' title='Position: "+x+","+oldy+"' id='"+idHandle+"' onClick='grid_click(this)' >";
mapgrid += "<div id='child_"+idHandle+"' class='child'></div></div>";
} else {
@@ -885,6 +891,8 @@ function mapAsHTML(map, targetWidth, demo) {
}
mapgrid += '</div>';
+ if (mapEditor == true) return mapgrid;
+
var r = '';
//TODO: Track down where that 1 pixel is comingfrom, width-1 is a hack.