mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
get back to using vertices
This commit is contained in:
parent
67235bc41e
commit
1cd9069b15
1 changed files with 3 additions and 14 deletions
|
|
@ -32,20 +32,9 @@
|
|||
|
||||
// get array of land cells aroound lake
|
||||
const getShoreline = function (lake) {
|
||||
const queue = [lake.firstCell];
|
||||
const used = [queue[0]];
|
||||
const landCellsAround = [];
|
||||
while (queue.length) {
|
||||
const q = queue.pop();
|
||||
for (const c of pack.cells.c[q]) {
|
||||
if (used[c]) continue;
|
||||
used[c] = true;
|
||||
if (pack.cells.f[c] === lake.i) queue.push(c);
|
||||
if (pack.cells.h[c] >= 20) landCellsAround.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
lake.shoreline = landCellsAround;
|
||||
const uniqueCells = new Set();
|
||||
lake.vertices.forEach(v => pack.vertices.c[v].forEach(c => pack.cells.h[c] >= 20 && uniqueCells.add(c)));
|
||||
lake.shoreline = [...uniqueCells];
|
||||
};
|
||||
|
||||
const cleanupLakeData = function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue