mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Merge branch 'master' of https://github.com/Azgaar/Fantasy-Map-Generator into dev-economics
This commit is contained in:
commit
7dc71a5616
33 changed files with 5797 additions and 2941 deletions
|
|
@ -89,8 +89,8 @@ function editStates() {
|
|||
for (const s of pack.states) {
|
||||
if (s.removed) continue;
|
||||
const area = s.area * distanceScaleInput.value ** 2;
|
||||
const rural = s.rural * populationRate.value;
|
||||
const urban = s.urban * populationRate.value * urbanization.value;
|
||||
const rural = s.rural * populationRate;
|
||||
const urban = s.urban * populationRate * urbanization;
|
||||
const population = rn(rural + urban);
|
||||
const populationTip = `Total population: ${si(population)}; Rural population: ${si(rural)}; Urban population: ${si(urban)}. Click to change`;
|
||||
totalArea += area;
|
||||
|
|
@ -362,8 +362,8 @@ function editStates() {
|
|||
tip('State does not have any cells, cannot change population', false, 'error');
|
||||
return;
|
||||
}
|
||||
const rural = rn(s.rural * populationRate.value);
|
||||
const urban = rn(s.urban * populationRate.value * urbanization.value);
|
||||
const rural = rn(s.rural * populationRate);
|
||||
const urban = rn(s.urban * populationRate * urbanization);
|
||||
const total = rural + urban;
|
||||
const l = (n) => Number(n).toLocaleString();
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ function editStates() {
|
|||
cells.forEach((i) => (pack.cells.pop[i] *= ruralChange));
|
||||
}
|
||||
if (!isFinite(ruralChange) && +ruralPop.value > 0) {
|
||||
const points = ruralPop.value / populationRate.value;
|
||||
const points = ruralPop.value / populationRate;
|
||||
const cells = pack.cells.i.filter((i) => pack.cells.state[i] === state);
|
||||
const pop = points / cells.length;
|
||||
cells.forEach((i) => (pack.cells.pop[i] = pop));
|
||||
|
|
@ -417,7 +417,7 @@ function editStates() {
|
|||
burgs.forEach((b) => (b.population = rn(b.population * urbanChange, 4)));
|
||||
}
|
||||
if (!isFinite(urbanChange) && +urbanPop.value > 0) {
|
||||
const points = urbanPop.value / populationRate.value / urbanization.value;
|
||||
const points = urbanPop.value / populationRate / urbanization;
|
||||
const burgs = pack.burgs.filter((b) => !b.removed && b.state === state);
|
||||
const population = rn(points / burgs.length, 4);
|
||||
burgs.forEach((b) => (b.population = population));
|
||||
|
|
@ -459,8 +459,21 @@ function editStates() {
|
|||
|
||||
function stateRemovePrompt(state) {
|
||||
if (customization) return;
|
||||
const message = 'Are you sure you want to remove the state? <br>This action cannot be reverted';
|
||||
confirmationDialog({title: 'Remove state', message, confirm: 'Remove', onConfirm: () => stateRemove(state)});
|
||||
|
||||
alertMessage.innerHTML = 'Are you sure you want to remove the state? <br>This action cannot be reverted';
|
||||
$('#alert').dialog({
|
||||
resizable: false,
|
||||
title: 'Remove state',
|
||||
buttons: {
|
||||
Remove: function () {
|
||||
$(this).dialog('close');
|
||||
stateRemove(state);
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function stateRemove(state) {
|
||||
|
|
@ -627,8 +640,8 @@ function editStates() {
|
|||
|
||||
const unit = areaUnit.value === 'square' ? ' ' + distanceUnitInput.value + '²' : ' ' + areaUnit.value;
|
||||
const area = d.data.area * distanceScaleInput.value ** 2 + unit;
|
||||
const rural = rn(d.data.rural * populationRate.value);
|
||||
const urban = rn(d.data.urban * populationRate.value * urbanization.value);
|
||||
const rural = rn(d.data.rural * populationRate);
|
||||
const urban = rn(d.data.urban * populationRate * urbanization);
|
||||
|
||||
const option = statesTreeType.value;
|
||||
const value =
|
||||
|
|
@ -1056,8 +1069,8 @@ function editStates() {
|
|||
data += el.dataset.burgs + ',';
|
||||
data += el.dataset.area + ',';
|
||||
data += el.dataset.population + ',';
|
||||
data += `${Math.round(pack.states[key].rural * populationRate.value)},`;
|
||||
data += `${Math.round(pack.states[key].urban * populationRate.value * urbanization.value)}\n`;
|
||||
data += `${Math.round(pack.states[key].rural * populationRate)},`;
|
||||
data += `${Math.round(pack.states[key].urban * populationRate * urbanization)}\n`;
|
||||
});
|
||||
|
||||
const name = getFileName('States') + '.csv';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue