mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11: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">
|
||||
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions.</label>
|
||||
</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/>
|
||||
<button id="start" data-tip="Start submap resampling" class="options glow" onclick="generateSubmap()">Generate</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ window.Submap = (function () {
|
|||
pack.states = parentMap.pack.states;
|
||||
// keep valid states and neighbors only
|
||||
pack.states.forEach((s, i) => {
|
||||
if (s.removed) return;
|
||||
if (!validStates.has(i)) s.removed=true;
|
||||
s.neighbors = s.neighbors.filter(n => validStates.has(n));
|
||||
});
|
||||
|
|
@ -204,10 +205,10 @@ window.Submap = (function () {
|
|||
Rivers.specify();
|
||||
Lakes.generateName();
|
||||
|
||||
stage("Modelling military.");
|
||||
Military.generate();
|
||||
addMarkers();
|
||||
addZones();
|
||||
stage("Modelling military, markers and zones (if requested).");
|
||||
if (options.addMilitary) Military.generate();
|
||||
if (options.addMarkers) addMarkers();
|
||||
if (options.addZones) addZones();
|
||||
Names.getMapName();
|
||||
stage("Submap done.");
|
||||
|
||||
|
|
@ -266,6 +267,7 @@ window.Submap = (function () {
|
|||
}
|
||||
const [water, coast] = res;
|
||||
[b.x, b.y] = b.port? getMiddlePoint(coast, water): cells.p[coast];
|
||||
if (b.port) b.port = cells.f[water];
|
||||
b.cell = coast;
|
||||
} if (b.port) {
|
||||
// find coast for ports on land
|
||||
|
|
@ -274,6 +276,7 @@ window.Submap = (function () {
|
|||
if (res) {
|
||||
const [coast, water] = res;
|
||||
[b.x, b.y] = getMiddlePoint(coast, water);
|
||||
b.port = cells.f[water]; // copy feature number
|
||||
b.cell = coast;
|
||||
} else {
|
||||
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),
|
||||
copyBurgs: Boolean(document.getElementById("submapCopyBurgs").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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue