mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.22.31
This commit is contained in:
parent
f684996f82
commit
bc6b8cdafe
18 changed files with 111 additions and 111 deletions
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
if (sorted.length < count * 10) {
|
||||
count = Math.floor(sorted.length / 10);
|
||||
if (!count) {console.warn(`There is no populated cells. Cannot generate states`); return burgs;}
|
||||
if (!count) {console.warn(`There is no populated cells. Cannot generate states`); return burgs;}
|
||||
else {console.warn(`Not enought populated cells (${sorted.length}). Will generate only ${count} states`);}
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
states.push({i, color: colors[i-1], name, expansionism, capital: i, type, center: b.cell, culture: b.culture});
|
||||
cells.burg[b.cell] = i;
|
||||
});
|
||||
|
||||
|
||||
console.timeEnd('createStates');
|
||||
return states;
|
||||
}
|
||||
|
|
@ -219,11 +219,11 @@
|
|||
capitalLabels.selectAll("text").data(capitals).enter()
|
||||
.append("text").attr("id", d => "burgLabel"+d.i).attr("data-id", d => d.i)
|
||||
.attr("x", d => d.x).attr("y", d => d.y).attr("dy", `${capitalSize * -1.5}px`).text(d => d.name);
|
||||
|
||||
|
||||
capitalAnchors.selectAll("use").data(capitals.filter(c => c.port)).enter()
|
||||
.append("use").attr("xlink:href", "#icon-anchor").attr("data-id", d => d.i)
|
||||
.attr("x", d => rn(d.x - caSize * .47, 2)).attr("y", d => rn(d.y - caSize * .47, 2))
|
||||
.attr("width", caSize).attr("height", caSize);
|
||||
.attr("width", caSize).attr("height", caSize);
|
||||
|
||||
// towns
|
||||
const towns = pack.burgs.filter(b => b.i && !b.capital);
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
states.filter(s => s.i && !s.removed).forEach(function(s) {
|
||||
cells.state[burgs[s.capital].cell] = s.i;
|
||||
const b = cells.biome[cultures[s.culture].center]; // native biome
|
||||
queue.queue({e:s.center, p:0, s:s.i, b});
|
||||
queue.queue({e:s.center, p:0, s:s.i, b});
|
||||
cost[s.center] = 1;
|
||||
});
|
||||
const neutral = cells.i.length / 5000 * 2000 * neutralInput.value * statesNeutral.value; // limit cost for state growth
|
||||
|
|
@ -312,7 +312,7 @@
|
|||
|
||||
function getRiverCost(r, i, type) {
|
||||
if (type === "River") return r ? 0 : 100; // penalty for river cultures
|
||||
if (!r) return 0; // no penalty for others if there is no river
|
||||
if (!r) return 0; // no penalty for others if there is no river
|
||||
return Math.min(Math.max(cells.fl[i] / 10, 20), 100) // river penalty from 20 to 100 based on flux
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +372,7 @@
|
|||
|
||||
function getHull(start, state, maxLake) {
|
||||
const queue = [start], hull = new Set();
|
||||
|
||||
|
||||
while (queue.length) {
|
||||
const q = queue.pop();
|
||||
const nQ = cells.c[q].filter(c => cells.state[c] === state);
|
||||
|
|
@ -388,7 +388,7 @@
|
|||
queue.push(c);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return hull;
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +414,7 @@
|
|||
while (queue.length) {
|
||||
const next = queue.dequeue(), n = next.e, p = next.p;
|
||||
if (n === end) break;
|
||||
|
||||
|
||||
for (const v of c.v[n]) {
|
||||
if (v === -1) continue;
|
||||
const totalCost = p + (inside[v] ? 1 : 100);
|
||||
|
|
@ -436,7 +436,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void function drawLabels() {
|
||||
const g = labels.select("#states"), t = defs.select("#textPaths");
|
||||
const displayed = layerIsOn("toggleLabels");
|
||||
|
|
@ -553,7 +553,7 @@
|
|||
states[s].area += cells.area[i];
|
||||
states[s].rural += cells.pop[i];
|
||||
if (cells.burg[i]) {
|
||||
states[s].urban += pack.burgs[cells.burg[i]].population;
|
||||
states[s].urban += pack.burgs[cells.burg[i]].population;
|
||||
states[s].burgs++;
|
||||
}
|
||||
}
|
||||
|
|
@ -995,8 +995,8 @@
|
|||
console.timeEnd("generateProvinces");
|
||||
}
|
||||
|
||||
return {generate, expandStates, normalizeStates, assignColors,
|
||||
drawBurgs, specifyBurgs, defineBurgFeatures, drawStateLabels, collectStatistics,
|
||||
return {generate, expandStates, normalizeStates, assignColors,
|
||||
drawBurgs, specifyBurgs, defineBurgFeatures, drawStateLabels, collectStatistics,
|
||||
generateDiplomacy, defineStateForms, getFullName, generateProvinces};
|
||||
|
||||
})));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue