Added cell info to elevation profile and corrected some spelling

This commit is contained in:
Evolvedexperiment 2020-06-26 19:08:54 +00:00
parent 36870a3881
commit 044ea1d345
9 changed files with 31 additions and 12 deletions

View file

@ -42,7 +42,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;}
else {console.warn(`Not enought populated cells (${sorted.length}). Will generate only ${count} states`);}
else {console.warn(`Not enough populated cells (${sorted.length}). Will generate only ${count} states`);}
}
let burgsTree = d3.quadtree();

View file

@ -27,7 +27,7 @@
});
return;
} else {
console.warn(`Not enought populated cells (${populated.length}). Will generate only ${count} cultures`);
console.warn(`Not enough populated cells (${populated.length}). Will generate only ${count} cultures`);
alertMessage.innerHTML = `
There are only ${populated.length} populated cells and it's insufficient livable area.<br>
Only ${count} out of ${culturesInput.value} requested cultures will be generated.<br>

View file

@ -56,7 +56,7 @@
//const min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
let min = cells.c[i][d3.scan(cells.c[i], (a, b) => h[a] - h[b])]; // downhill cell
// allow only one river can flow thought a lake
// allow only one river can flow through a lake
const cf = features[cells.f[i]]; // current cell feature
if (cf.river && cf.river !== cells.r[i]) {
cells.fl[i] = 0;

View file

@ -8,7 +8,7 @@
console.time("generateMainRoads");
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
const capitals = burgs.filter(b => b.capital);
if (capitals.length < 2) return []; // not enought capitals to build main roads
if (capitals.length < 2) return []; // not enough capitals to build main roads
const paths = []; // array to store path segments
for (const b of capitals) {
@ -28,7 +28,7 @@
const getTrails = function() {
console.time("generateTrails");
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
if (burgs.length < 2) return []; // not enought burgs to build trails
if (burgs.length < 2) return []; // not enough burgs to build trails
let paths = []; // array to store path segments
for (const f of pack.features.filter(f => f.land)) {
@ -243,4 +243,4 @@
return [from, exit, false];
}
})));
})));

View file

@ -196,7 +196,26 @@ function showElevationProfile(data, routeLen, isRiver) {
const x = chartData.points[k][0];
const y = yOffset + chartHeight;
const c = biomesData.color[chartData.biome[k]];
const dataTip = biomesData.name[chartData.biome[k]]+" (" + chartData.height[k] + " " + hu + ", cell " + chartData.cell[k] + ")";
const cell = chartData.cell[k];
const culture = pack.cells.culture[cell];
const religion = pack.cells.religion[cell];
const province = pack.cells.province[cell];
const state = pack.cells.state[cell];
let pop = pack.cells.pop[cell];
if (chartData.burg[k]) {
pop += pack.burgs[chartData.burg[k]].population * urbanization.value;
}
const populationDesc = rn(pop * populationRate.value);
const provinceDesc = province ? ", " + pack.provinces[province].name : "";
const dataTip = biomesData.name[chartData.biome[k]] +
provinceDesc +
", " + pack.states[state].name +
", " + pack.religions[religion].name +
", " + pack.cultures[culture].name +
" (height: " + chartData.height[k] + " " + hu + ", population " + populationDesc + ", cell " + chartData.cell[k] + ")";
g.append("rect").attr("stroke", c).attr("fill", c).attr("x", x).attr("y", y).attr("width", xscale(1)).attr("height", 15).attr("data-tip", dataTip);
}

View file

@ -155,7 +155,7 @@ function regenerateStates() {
return;
}
if (burgs.length < +regionsInput.value) {
tip(`Not enought burgs to generate ${regionsInput.value} states. Will generate only ${burgs.length} states`, false, "warn");
tip(`Not enough burgs to generate ${regionsInput.value} states. Will generate only ${burgs.length} states`, false, "warn");
}
// burg local ids sorted by a bit randomized population: