This commit is contained in:
Azgaar 2019-09-08 14:01:21 +03:00
parent 263c2d6a3c
commit 0140eccd9f
15 changed files with 31 additions and 64 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
.DS_Store
wikidata

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018-2019 Max Ganiev (Azgaar)
Copyright 2018-2019 Max Ganiev (Azgaar), azgaar.fmg@yandex.by
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -12,7 +12,7 @@ Refer to the [project wiki](https://github.com/Azgaar/Fantasy-Map-Generator/wiki
[![preview](https://cdn.discordapp.com/attachments/587406457725779968/594840632296734720/preview3.png)](https://cdn.discordapp.com/attachments/515359096925454350/593891237984206848/The_Wichin_Island_-_diplomacy.png)
Join our [Reddit community](https://www.reddit.com/r/FantasyMapGenerator) and [Discord server](https://discordapp.com/invite/X7E84HU) to share the created maps, discuss the Generator, suggest ideas and get a most recent updates. You may also contact me directly via [email](mailto:maxganiev@yandex.com). For bug reports please use the project [issues page](https://github.com/Azgaar/Fantasy-Map-Generator/issues) or Discord "Bugs" channel. If you are facing performance issues, please read [the tips](https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Tips#performance-tips).
Join our [Reddit community](https://www.reddit.com/r/FantasyMapGenerator) and [Discord server](https://discordapp.com/invite/X7E84HU) to share the created maps, discuss the Generator, suggest ideas and get a most recent updates. You may also contact me directly via [email](mailto:azgaar.fmg@yandex.by). For bug reports please use the project [issues page](https://github.com/Azgaar/Fantasy-Map-Generator/issues) or Discord "Bugs" channel. If you are facing performance issues, please read [the tips](https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Tips#performance-tips).
You can support the project [on Patreon](https://www.patreon.com/azgaar).

View file

@ -1931,7 +1931,7 @@ svg.button {
#errorBox {
font-size: .9em;
font-family: monospace;
font-family: Consolas, monospace;
color: #920303;
background-color: #dabdbd91;
padding: 2px;

View file

@ -1812,7 +1812,7 @@
<div id="aboutContent" class="tabcontent">
<p><a href="https://github.com/Azgaar/Fantasy-Map-Generator" target="_blank">Fantasy Map Generator</a> is a free <a href="https://github.com/Azgaar/Fantasy-Map-Generator/blob/master/LICENSE" target="_blank">open source</a> tool which procedurally generates fantasy maps. You may use auto-generated maps as they are, edit them or even create a new map from scratch. Check out the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Quick-Start-Tutorial" target="_blank">quick start tutorial</a> and <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki" target="_blank">project wiki</a> for guidance.</p>
<p>Join our <a href='https://discordapp.com/invite/X7E84HU' target='_blank'>Discord server</a> and <a href="https://www.reddit.com/r/FantasyMapGenerator/" target="_blank">Reddit community</a> to ask questions, get help and share created maps. You may support the project on <a href='https://www.patreon.com/azgaar' target='_blank'>Patreon</a>.</p>
<p>The project is under active development. For older versions see the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog" target="_blank">changelog</a>. To track the development progress see the <a href="https://trello.com/b/7x832DG4/fantasy-map-generator" target="_blank">devboard</a>. Please report bugs <a href="https://github.com/Azgaar/Fantasy-Map-Generator/issues" target="_blank">here</a>. You can also contact me directly via <a href="mailto:maxganiev@yandex.ru" target="_blank">email</a>.</p>
<p>The project is under active development. For older versions see the <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog" target="_blank">changelog</a>. To track the development progress see the <a href="https://trello.com/b/7x832DG4/fantasy-map-generator" target="_blank">devboard</a>. Please report bugs <a href="https://github.com/Azgaar/Fantasy-Map-Generator/issues" target="_blank">here</a>. You can also contact me directly via <a href="mailto:azgaar.fmg@yandex.by" target="_blank">email</a>.</p>
<p>A special thanks to all supporters! <i data-tip="Click to see supporters names" class="collapsible icon-down-open pointer"></i></p>
<p style="display:none">Supporters: Aaron Meyer, Ahmad Amerih, AstralJacks, aymeric, Billy Dean Goehring, Branndon Edwards,
Chase Mayers, Curt Flood, cyninge, Dino Princip, E.M. White, es, Fondue, Fritjof Olsson, Gatsu, Johan Fröberg, Jonathan Moore,
@ -1838,7 +1838,7 @@
<div id="saveMap" data-tip="Download the map as fully functional .map file to your machine. Shortcut: Ctrl + M">.map</div>
<div id="saveSVG" data-tip="Download the map as vector image (open in browser or Inkscape). Shortcut: Ctrl + S">.svg</div>
<div id="savePNG" data-tip="Download visible part of the map as .png image. Shortcut: Ctrl + P">.png</div>
<div id="saveGeo" data-tip="Download cell data as GeoJSON (for use in GIS tools such as QGIS).">.json</div>
<div id="saveGeo" data-tip="Download map data as GeoJSON (for use in GIS tools such as QGIS)">.json</div>
<div id="quickSave" data-tip="Save map to browser storage. Shortcut: F6">storage</div>
<!-- <div id="saveDropbox" data-tip="Save fully functional .map file to Dropbox. Shortcut: Ctrl + B">Dropbox</div> -->
</div>
@ -2385,7 +2385,7 @@
<button id="templateRedo" data-tip="Redo the action" class="icon-cw" disabled></button>
<button id="templateSave" data-tip="Download the template as a text file" class="icon-download"></button>
<button id="templateLoad" data-tip="Open previously downloaded template" class="icon-upload"></button>
<button id="templateMail" onclick="window.open('mailto:maxganiev@yandex.com?Subject=Template%20suggestion', '_blank')" data-tip="Send a template suggestion to Azgaar" class="icon-mail-alt"></button>
<button id="templateMail" onclick="window.open('mailto:azgaar.fmg@yandex.by?Subject=Template%20suggestion', '_blank')" data-tip="Send a template suggestion to Azgaar" class="icon-mail-alt"></button>
</div>
</div>

15
main.js
View file

@ -1,5 +1,5 @@
// Fantasy Map Generator main script
// Azgaar (maxganiev@yandex.com). Minsk, 2017-2019
// Azgaar (azgaar.fmg@yandex.by). Minsk, 2017-2019
// https://github.com/Azgaar/Fantasy-Map-Generator
// MIT License
@ -688,17 +688,14 @@ function generate() {
console.error(error);
clearMainTip();
const regex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
const errorNoURL = error.stack.replace(regex, url => '<i>' + last(url.split("/")) + '</i>');
const errorParsed = errorNoURL.replace(/at /ig, "<br>&nbsp;&nbsp;at ");
alertMessage.innerHTML = `An error is occured on map generation. Please retry.
<br>If error persists, clear the stored data and try again.
<p id="errorBox">${errorParsed}</p>`;
<br>If error is critical, clear the stored data and try again.
<p id="errorBox">${parseError(error)}</p>`;
$("#alert").dialog({
resizable: false, title: "Generation error", maxWidth:500, buttons: {
resizable: false, title: "Generation error", width:320, buttons: {
"Clear data": function() {localStorage.clear(); localStorage.setItem("version", version);},
Regenerate: function() {regenerateMap(); $(this).dialog("close");}
Regenerate: function() {regenerateMap(); $(this).dialog("close");},
Ignore: function() {$(this).dialog("close");}
}, position: {my: "center", at: "center", of: "svg"}
});
}

View file

@ -1,11 +0,0 @@
Hill 6-12 10-20 10-90 10-90
Hill 2-5 20-30 25-75 20-80
Smooth 1 0 0 0
Range 0-2 30-60 25-75 25-75
Smooth 2 0 0 0
Range 1-2 40-50 40-60 40-60
Multiply 1.2 land 0 0
Pit 1-3 10-30 30-70 20-80
Trough 0-2 20-30 15-85 20-80
Hill 2-4 10-25 15-85 20-80
Smooth 3 0 0 0

View file

@ -1,14 +0,0 @@
Hill 2-3 10-25 20-30 20-30
Hill 1-2 10-25 20-30 70-80
Hill 2-3 10-25 70-80 20-30
Hill 1-2 10-25 70-80 70-80
Hill 6-12 10-20 30-70 30-70
Smooth 1 0 0 0
Hill 4-6 10-30 30-70 30-70
Range 1-2 40-50 20-80 20-40
Trough 1-2 10-30 15-85 40-80
Pit 2-4 10-20 15-85 20-80
Pit 1-2 20-30 25-75 60-80
Smooth 3 0 0 0
Range 0-2 40-50 15-85 20-80
Trough 0-2 40-50 15-85 20-80

View file

@ -1,13 +0,0 @@
Hill 1 90-100 45-55 25-30
Hill 1 60-80 45-55 70-75
Hill 1 60-80 30-50 40-50
Hill 1 40-50 50-70 40-60
Multiply 0.6 20-100 0 0
Smooth 1 0 0 0
Range 0-2 40-50 30-60 30-60
Trough 1-3 20-40 25-75 20-80
Smooth 2 0 0 0
Pit 3-5 10-30 15-85 20-80
Hill 3-5 10-30 20-80 20-80
Range 1-2 20-50 30-70 20-65
Trough 1-2 20-50 15-85 20-80

View file

@ -436,6 +436,8 @@
void function drawLabels() {
const g = labels.select("#states"), t = defs.select("#textPaths");
const displayed = layerIsOn("toggleLabels");
if (!displayed) toggleLabels();
if (!list) {
g.selectAll("text").remove();
@ -520,6 +522,7 @@
});
example.remove();
if (!displayed) toggleLabels();
}()
console.timeEnd("drawStateLabels");
@ -583,6 +586,7 @@
const generateDiplomacy = function() {
console.time("generateDiplomacy");
const cells = pack.cells, states = pack.states;
const chronicle = states[0].diplomacy = [];
const valid = states.filter(s => s.i && !states.removed);
if (valid.length < 2) return;
@ -592,7 +596,6 @@
const navals = {"Neutral":1, "Suspicion":2, "Rival":1, "Unknown":1}; // relations of naval powers
valid.forEach(s => s.diplomacy = new Array(states.length).fill("x")); // clear all relationships
const chronicle = states[0].diplomacy = [];
const areaMean = d3.mean(valid.map(s => s.area)); // avarage state area
// generic relations

View file

@ -695,6 +695,7 @@ function parseLoadedData(data) {
// v 1.0 initially has Sympathy status then relaced with Friendly
for (const s of pack.states) {
if (!s.diplomacy) continue;
s.diplomacy = s.diplomacy.map(r => r === "Sympathy" ? "Friendly" : r);
}
}
@ -713,13 +714,9 @@ function parseLoadedData(data) {
console.error(error);
clearMainTip();
const regex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
const errorNoURL = error.stack.replace(regex, url => '<i>' + last(url.split("/")) + '</i>');
const errorParsed = errorNoURL.replace(/ at /ig, "<br>&nbsp;&nbsp;at ");
alertMessage.innerHTML = `An error is occured on map loading. Select a different file to load,
<br>generate a new random map or cancel the loading
<p id="errorBox">${errorParsed}</p>`;
<p id="errorBox">${parseError(error)}</p>`;
$("#alert").dialog({
resizable: false, title: "Loading error", maxWidth:500, buttons: {
"Select file": function() {$(this).dialog("close"); mapToLoad.click();},

View file

@ -2,7 +2,7 @@
function editDiplomacy() {
if (customization) return;
if (pack.states.filter(s => s.i && !s.removed).length < 2) {
tip("There should be at least 2 states to edit the diplomacy", false, "Error");
tip("There should be at least 2 states to edit the diplomacy", false, "error");
return;
}

View file

@ -1011,11 +1011,11 @@ function toggleMarkers() {
function toggleLabels() {
if (!layerIsOn("toggleLabels")) {
turnButtonOn("toggleLabels");
$('#labels').fadeIn();
labels.attr("display", null)
invokeActiveZooming();
} else {
turnButtonOff("toggleLabels");
$('#labels').fadeOut();
labels.attr("display", "none");
}
}

File diff suppressed because one or more lines are too long