mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 04:21:24 +01:00
fix invalid feature number at burg.ports, option to disable regenerations
This commit is contained in:
parent
968a4725cc
commit
25575b8966
3 changed files with 22 additions and 4 deletions
12
index.html
12
index.html
|
|
@ -3525,6 +3525,18 @@
|
||||||
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox">
|
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox">
|
||||||
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions.</label>
|
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions.</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-tip="Regenerate military data in submap." >
|
||||||
|
<input id="submapAddMilitary" class="checkbox" type="checkbox">
|
||||||
|
<label for="submapAddMilitary" class="checkbox-label">Add Military</label>
|
||||||
|
</div>
|
||||||
|
<div data-tip="Regenerate markers data in submap." >
|
||||||
|
<input id="submapAddMarkers" class="checkbox" type="checkbox" checked>
|
||||||
|
<label for="submapAddMarkers" class="checkbox-label">Add Markers</label>
|
||||||
|
</div>
|
||||||
|
<div data-tip="Regenerate military data in submap." >
|
||||||
|
<input id="submapAddZones" class="checkbox" type="checkbox" checked>
|
||||||
|
<label for="submapAddZones" class="checkbox-label">Add Zones</label>
|
||||||
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button id="start" data-tip="Start submap resampling" class="options glow" onclick="generateSubmap()">Generate</button>
|
<button id="start" data-tip="Start submap resampling" class="options glow" onclick="generateSubmap()">Generate</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ window.Submap = (function () {
|
||||||
pack.states = parentMap.pack.states;
|
pack.states = parentMap.pack.states;
|
||||||
// keep valid states and neighbors only
|
// keep valid states and neighbors only
|
||||||
pack.states.forEach((s, i) => {
|
pack.states.forEach((s, i) => {
|
||||||
|
if (s.removed) return;
|
||||||
if (!validStates.has(i)) s.removed=true;
|
if (!validStates.has(i)) s.removed=true;
|
||||||
s.neighbors = s.neighbors.filter(n => validStates.has(n));
|
s.neighbors = s.neighbors.filter(n => validStates.has(n));
|
||||||
});
|
});
|
||||||
|
|
@ -204,10 +205,10 @@ window.Submap = (function () {
|
||||||
Rivers.specify();
|
Rivers.specify();
|
||||||
Lakes.generateName();
|
Lakes.generateName();
|
||||||
|
|
||||||
stage("Modelling military.");
|
stage("Modelling military, markers and zones (if requested).");
|
||||||
Military.generate();
|
if (options.addMilitary) Military.generate();
|
||||||
addMarkers();
|
if (options.addMarkers) addMarkers();
|
||||||
addZones();
|
if (options.addZones) addZones();
|
||||||
Names.getMapName();
|
Names.getMapName();
|
||||||
stage("Submap done.");
|
stage("Submap done.");
|
||||||
|
|
||||||
|
|
@ -266,6 +267,7 @@ window.Submap = (function () {
|
||||||
}
|
}
|
||||||
const [water, coast] = res;
|
const [water, coast] = res;
|
||||||
[b.x, b.y] = b.port? getMiddlePoint(coast, water): cells.p[coast];
|
[b.x, b.y] = b.port? getMiddlePoint(coast, water): cells.p[coast];
|
||||||
|
if (b.port) b.port = cells.f[water];
|
||||||
b.cell = coast;
|
b.cell = coast;
|
||||||
} if (b.port) {
|
} if (b.port) {
|
||||||
// find coast for ports on land
|
// find coast for ports on land
|
||||||
|
|
@ -274,6 +276,7 @@ window.Submap = (function () {
|
||||||
if (res) {
|
if (res) {
|
||||||
const [coast, water] = res;
|
const [coast, water] = res;
|
||||||
[b.x, b.y] = getMiddlePoint(coast, water);
|
[b.x, b.y] = getMiddlePoint(coast, water);
|
||||||
|
b.port = cells.f[water]; // copy feature number
|
||||||
b.cell = coast;
|
b.cell = coast;
|
||||||
} else {
|
} else {
|
||||||
WARN && console.warn(`Can't find water near port ${b.name}. :-/`);
|
WARN && console.warn(`Can't find water near port ${b.name}. :-/`);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ const generateSubmap = debounce(async function () {
|
||||||
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
|
depressRivers: Boolean(document.getElementById("submapDepressRivers").checked),
|
||||||
copyBurgs: Boolean(document.getElementById("submapCopyBurgs").checked),
|
copyBurgs: Boolean(document.getElementById("submapCopyBurgs").checked),
|
||||||
addLakesInDepressions: Boolean(document.getElementById("submapAddLakeInDepression").checked),
|
addLakesInDepressions: Boolean(document.getElementById("submapAddLakeInDepression").checked),
|
||||||
|
addMilitary: Boolean(document.getElementById("submapAddMilitary").checked),
|
||||||
|
addMarkers: Boolean(document.getElementById("submapAddMarkers").checked),
|
||||||
|
addZones: Boolean(document.getElementById("submapAddZones").checked),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create projection func from current zoom extents
|
// Create projection func from current zoom extents
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue