Requested Changes

This commit is contained in:
Onyx Azryn 2020-10-21 11:59:19 -05:00
parent 6cbcc81332
commit df9ede80f3
5 changed files with 15 additions and 16 deletions

15
main.js
View file

@ -11,11 +11,10 @@ const version = "1.4"; // generator version
document.title += " v" + version;
// Switches to disable/enable logging features
var LOG = 0;
var TIME = 0;
var GROUP = 0;
var WARN = 0;
var ERROR = 0;
const INFO = 0;
const TIME = 0;
const WARN = 1;
const ERROR = 1;
// if map version is not stored, clear localStorage and show a message
if (rn(localStorage.getItem("version"), 2) !== rn(version, 2)) {
@ -514,7 +513,7 @@ function generate() {
const timeStart = performance.now();
invokeActiveZooming();
generateSeed();
GROUP && console.group("Generated Map " + seed);
INFO && console.group("Generated Map " + seed);
applyMapSize();
randomizeOptions();
placePoints();
@ -557,7 +556,7 @@ function generate() {
WARN && console.warn(`TOTAL: ${rn((performance.now()-timeStart)/1000,2)}s`);
showStatistics();
GROUP && console.groupEnd("Generated Map " + seed);
INFO && console.groupEnd("Generated Map " + seed);
}
catch(error) {
ERROR && console.error(error);
@ -1719,7 +1718,7 @@ function showStatistics() {
mapId = Date.now(); // unique map id is it's creation date number
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created:mapId});
LOG && console.log(stats);
INFO && console.log(stats);
}
const regenerateMap = debounce(function() {

View file

@ -564,7 +564,7 @@ function parseLoadedData(data) {
mapId = params[6] ? +params[6] : Date.now();
}()
GROUP && console.group("Loaded Map " + seed);
INFO && console.group("Loaded Map " + seed);
void function parseSettings() {
const settings = data[1].split("|");
@ -1067,7 +1067,7 @@ function parseLoadedData(data) {
WARN && console.warn(`TOTAL: ${rn((performance.now()-uploadMap.timeStart)/1000,2)}s`);
showStatistics();
GROUP && console.groupEnd("Loaded Map " + seed);
INFO && console.groupEnd("Loaded Map " + seed);
tip("Map is successfully loaded", true, "success", 7000);
}
catch(error) {

View file

@ -164,7 +164,7 @@ function editHeightmap() {
}
function regenerateErasedData() {
GROUP && console.group("Edit Heightmap");
INFO && console.group("Edit Heightmap");
TIME && console.time("regenerateErasedData");
const change = changeHeights.checked;
@ -205,7 +205,7 @@ function editHeightmap() {
addMarkers();
addZones();
TIME && console.timeEnd("regenerateErasedData");
GROUP && console.groupEnd("Edit Heightmap");
INFO && console.groupEnd("Edit Heightmap");
}
function restoreKeptData() {
@ -216,7 +216,7 @@ function editHeightmap() {
}
function restoreRiskedData() {
GROUP && console.group("Edit Heightmap");
INFO && console.group("Edit Heightmap");
TIME && console.time("restoreRiskedData");
// assign pack data to grid cells
@ -402,7 +402,7 @@ function editHeightmap() {
});
TIME && console.timeEnd("restoreRiskedData");
GROUP && console.groupEnd("Edit Heightmap");
INFO && console.groupEnd("Edit Heightmap");
}
// trigger heightmap redraw and history update if at least 1 cell is changed

View file

@ -653,7 +653,7 @@ function setBase64Texture(url) {
};
function fetchTextureURL(url) {
LOG && console.log("Provided URL is", url);
INFO && console.log("Provided URL is", url);
const img = new Image();
img.onload = function () {
const canvas = document.getElementById("texturePreview");

View file

@ -628,4 +628,4 @@ void function() {
}()
// indexedDB; ldb object
!function(){function e(t,o){return n?void(n.transaction("s").objectStore("s").get(t).onsuccess=function(e){var t=e.target.result&&e.target.result.v||null;o(t)}):void setTimeout(function(){e(t,o)},100)}var t=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(!t)return void ERROR && console.error("indexedDB not supported");var n,o={k:"",v:""},r=t.open("d2",1);r.onsuccess=function(e){n=this.result},r.onerror=function(e){ERROR && console.error("indexedDB request error"),LOG && console.log(e)},r.onupgradeneeded=function(e){n=null;var t=e.target.result.createObjectStore("s",{keyPath:"k"});t.transaction.oncomplete=function(e){n=e.target.db}},window.ldb={get:e,set:function(e,t){o.k=e,o.v=t,n.transaction("s","readwrite").objectStore("s").put(o)}}}();
!function(){function e(t,o){return n?void(n.transaction("s").objectStore("s").get(t).onsuccess=function(e){var t=e.target.result&&e.target.result.v||null;o(t)}):void setTimeout(function(){e(t,o)},100)}var t=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(!t)return void ERROR && console.error("indexedDB not supported");var n,o={k:"",v:""},r=t.open("d2",1);r.onsuccess=function(e){n=this.result},r.onerror=function(e){ERROR && console.error("indexedDB request error"),INFO && console.log(e)},r.onupgradeneeded=function(e){n=null;var t=e.target.result.createObjectStore("s",{keyPath:"k"});t.transaction.oncomplete=function(e){n=e.target.db}},window.ldb={get:e,set:function(e,t){o.k=e,o.v=t,n.transaction("s","readwrite").objectStore("s").put(o)}}}();