mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
collect statistics for a short period
This commit is contained in:
parent
2a9edd2458
commit
5d714c8c17
9 changed files with 160 additions and 53 deletions
12
main.js
12
main.js
|
|
@ -652,11 +652,13 @@ function generate() {
|
|||
INFO && console.groupEnd("Generated Map " + seed);
|
||||
} catch (error) {
|
||||
ERROR && console.error(error);
|
||||
const parsedError = parseError(error);
|
||||
track("error", parsedError);
|
||||
clearMainTip();
|
||||
|
||||
alertMessage.innerHTML = `An error is occured on map generation. Please retry.
|
||||
<br>If error is critical, clear the stored data and try again.
|
||||
<p id="errorBox">${parseError(error)}</p>`;
|
||||
<p id="errorBox">${parsedError}</p>`;
|
||||
$("#alert").dialog({
|
||||
resizable: false,
|
||||
title: "Generation error",
|
||||
|
|
@ -667,7 +669,7 @@ function generate() {
|
|||
localStorage.setItem("version", version);
|
||||
},
|
||||
Regenerate: function () {
|
||||
regenerateMap();
|
||||
regenerateMap("generation error");
|
||||
$(this).dialog("close");
|
||||
},
|
||||
Ignore: function () {
|
||||
|
|
@ -1830,7 +1832,7 @@ function addZones(number = 1) {
|
|||
|
||||
// show map stats on generation complete
|
||||
function showStatistics() {
|
||||
const template = templateInput.value;
|
||||
const template = templateInput.options[templateInput.selectedIndex].text;
|
||||
const templateRandom = locked("template") ? "" : "(random)";
|
||||
const stats = ` Seed: ${seed}
|
||||
Canvas size: ${graphWidth}x${graphHeight}
|
||||
|
|
@ -1848,9 +1850,10 @@ function showStatistics() {
|
|||
mapId = Date.now(); // unique map id is it's creation date number
|
||||
mapHistory.push({seed, width: graphWidth, height: graphHeight, template, created: mapId});
|
||||
INFO && console.log(stats);
|
||||
track("generate", `Template: ${template} ${templateRandom}. Points: ${pointsInput.dataset.cells}`);
|
||||
}
|
||||
|
||||
const regenerateMap = debounce(function () {
|
||||
const regenerateMap = debounce(function (source) {
|
||||
WARN && console.warn("Generate new random map");
|
||||
closeDialogs("#worldConfigurator, #options3d");
|
||||
customization = 0;
|
||||
|
|
@ -1860,6 +1863,7 @@ const regenerateMap = debounce(function () {
|
|||
restoreLayers();
|
||||
if (ThreeD.options.isOn) ThreeD.redraw();
|
||||
if ($("#worldConfigurator").is(":visible")) editWorld();
|
||||
track("regenerate", `from ${source}`);
|
||||
}, 1000);
|
||||
|
||||
// clear the map
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue