mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
Detect heightmap based on pack data, convert to warning.
This commit is contained in:
parent
8735ca8a3e
commit
0bea5bb9bd
1 changed files with 2 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ main function: resample(options);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.Submap = (function () {
|
window.Submap = (function () {
|
||||||
const isWater = (map, id) => (map.grid.cells.h[map.pack.cells.g[id]] < 20 ? true : false);
|
const isWater = (map, id) => map.pack.cells.h[id] < 20;
|
||||||
const inMap = (x, y) => x > 0 && x < graphWidth && y > 0 && y < graphHeight;
|
const inMap = (x, y) => x > 0 && x < graphWidth && y > 0 && y < graphHeight;
|
||||||
|
|
||||||
function resample(parentMap, options) {
|
function resample(parentMap, options) {
|
||||||
|
|
@ -126,7 +126,6 @@ window.Submap = (function () {
|
||||||
// generatePrecipitation();
|
// generatePrecipitation();
|
||||||
stage("Cell cleanup.");
|
stage("Cell cleanup.");
|
||||||
reGraph();
|
reGraph();
|
||||||
const childMap = {grid, pack};
|
|
||||||
|
|
||||||
// remove misclassified cells
|
// remove misclassified cells
|
||||||
stage("Define coastline.");
|
stage("Define coastline.");
|
||||||
|
|
@ -141,6 +140,7 @@ window.Submap = (function () {
|
||||||
|
|
||||||
const pn = pack.cells.i.length;
|
const pn = pack.cells.i.length;
|
||||||
const cells = pack.cells;
|
const cells = pack.cells;
|
||||||
|
const childMap = {grid, pack};
|
||||||
cells.culture = new Uint16Array(pn);
|
cells.culture = new Uint16Array(pn);
|
||||||
cells.state = new Uint16Array(pn);
|
cells.state = new Uint16Array(pn);
|
||||||
cells.burg = new Uint16Array(pn);
|
cells.burg = new Uint16Array(pn);
|
||||||
|
|
@ -182,7 +182,6 @@ window.Submap = (function () {
|
||||||
// this should be always true, unless some algo modded the height!
|
// this should be always true, unless some algo modded the height!
|
||||||
if (isWater(parentMap, oid) !== isWater(childMap, id)) {
|
if (isWater(parentMap, oid) !== isWater(childMap, id)) {
|
||||||
console.warn(`cell sank because of addLakesInDepressions: ${oid}`);
|
console.warn(`cell sank because of addLakesInDepressions: ${oid}`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const [oldpx, oldpy] = oldCells.p[oid];
|
const [oldpx, oldpy] = oldCells.p[oid];
|
||||||
const nd = distance(projection(oldpx, oldpy));
|
const nd = distance(projection(oldpx, oldpy));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue