mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.0.10
This commit is contained in:
parent
263c2d6a3c
commit
0140eccd9f
15 changed files with 31 additions and 64 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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> 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();},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
Loading…
Add table
Add a link
Reference in a new issue