mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 20:41:23 +01:00
Lock markers and lock burgs options
This commit is contained in:
parent
77bac478af
commit
5461685d23
3 changed files with 32 additions and 15 deletions
15
index.html
15
index.html
|
|
@ -3685,10 +3685,6 @@
|
|||
<input id="submapCopyRivers" class="checkbox" type="checkbox">
|
||||
<label for="submapCopyRivers" class="checkbox-label">Rivers</label>
|
||||
</div>
|
||||
<div data-tip="Copy markers from the original map. Regenerate markers if not checked." >
|
||||
<input id="submapCopyMarkers" class="checkbox" type="checkbox" checked>
|
||||
<label for="submapCopyMarkers" class="checkbox-label">Markers</label>
|
||||
</div>
|
||||
<div data-tip="Copy Zones from the original map. Regenerate Zones if not checked." class="disabled">
|
||||
<input id="submapCopyZones" class="checkbox" type="checkbox" disabled>
|
||||
<label for="submapCopyZones" class="checkbox-label">Zones</label>
|
||||
|
|
@ -3698,6 +3694,17 @@
|
|||
<label for="submapCopyRoads" class="checkbox-label">Roads</label>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<p>Lock remapped items for:</p>
|
||||
<div data-tip="Lock all markers copied from the original map." >
|
||||
<input id="submapLockMarkers" class="checkbox" type="checkbox" checked>
|
||||
<label for="submapLockMarkers" class="checkbox-label">Markers</label>
|
||||
</div>
|
||||
<div data-tip="Lock all burgs copied from the original map." >
|
||||
<input id="submapLockBurgs" class="checkbox" type="checkbox" checked>
|
||||
<label for="submapLockBurgs" class="checkbox-label">Burgs (cities)</label>
|
||||
</div>
|
||||
|
||||
<p>Extra / experimental features:</p>
|
||||
<div data-tip="Rivers on the parent map errode land (helps to get similar river network.)" >
|
||||
<input id="submapDepressRivers" class="checkbox" type="checkbox">
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Experimental submaping module
|
|||
|
||||
window.Submap = (function () {
|
||||
const isWater = (map, id) => map.grid.cells.h[map.pack.cells.g[id]] < 20? true: false;
|
||||
const inMap = (x,y) => x>0 && x<graphWidth && y>0 && y<graphHeight;
|
||||
|
||||
function resample(parentMap, projection, options) {
|
||||
// generate new map based on an existing one (resampling parentMap)
|
||||
|
|
@ -290,13 +291,21 @@ window.Submap = (function () {
|
|||
}
|
||||
Military.redraw();
|
||||
|
||||
stage("markers and zones (if requested).");
|
||||
if (!options.copyMarkers) Markers.generate();
|
||||
else {
|
||||
// TODO
|
||||
pack.markers = [];
|
||||
stage("Copying markers.");
|
||||
for (const m of pack.markers) {
|
||||
const [x, y] = projection(m.x, m.y, false);
|
||||
if (!inMap(x, y)) {
|
||||
Markers.deleteMarker(m.i);
|
||||
} else {
|
||||
m.x = x;
|
||||
m.y = y;
|
||||
m.cell = findCell(x, y);
|
||||
if (options.lockMarkers) m.lock = true;
|
||||
}
|
||||
}
|
||||
drawMarkers();
|
||||
|
||||
stage("Regenerating Zones.");
|
||||
if (!options.copyZones) addZones();
|
||||
Names.getMapName();
|
||||
stage("Submap done.");
|
||||
|
|
@ -327,7 +336,6 @@ window.Submap = (function () {
|
|||
}
|
||||
|
||||
function copyBurgs(parentMap, projection, options) {
|
||||
const inMap = (x,y) => x>0 && x<graphWidth && y>0 && y<graphHeight;
|
||||
const cells = pack.cells;
|
||||
const childMap = { grid, pack }
|
||||
const isCoast = c => cells.t[c] === 1
|
||||
|
|
@ -379,7 +387,7 @@ window.Submap = (function () {
|
|||
b.cell = cityCell;
|
||||
[b.x, b.y] = cells.p[cityCell];
|
||||
}
|
||||
b.lock = true;
|
||||
if (!b.lock) b.lock = options.lockBurgs;
|
||||
pack.cells.burg[b.cell] = id;
|
||||
if (options.promoteTown) b.capital = 1;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ const generateSubmap = debounce(async function () {
|
|||
const checked = id => Boolean(document.getElementById(id).checked)
|
||||
const options = {
|
||||
copyBurgs: checked("submapCopyBurgs"),
|
||||
copyMarkers: checked("submapCopyMarkers"),
|
||||
copyZones: checked("submapCopyZones"),
|
||||
copyZones: checked("submapCopyRivers"),
|
||||
copyZones: checked("submapCopyRoads"),
|
||||
copyRivers: checked("submapCopyRivers"),
|
||||
copyRoads: checked("submapCopyRoads"),
|
||||
|
||||
lockMarkers: checked("submapLockMarkers"),
|
||||
lockBurgs: checked("submapLockBurgs"),
|
||||
|
||||
depressRivers: checked("submapDepressRivers"),
|
||||
addLakesInDepressions: checked("submapAddLakeInDepression"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue