mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.22
This commit is contained in:
parent
5ffd30dee8
commit
ae966ffe87
12 changed files with 497 additions and 233 deletions
|
|
@ -4,7 +4,7 @@
|
|||
(global.Rivers = factory());
|
||||
}(this, (function () {'use strict';
|
||||
|
||||
const generate = function Rivers() {
|
||||
const generate = function() {
|
||||
console.time('generateRivers');
|
||||
Math.seedrandom(seed);
|
||||
const cells = pack.cells, p = cells.p, features = pack.features;
|
||||
|
|
@ -285,11 +285,11 @@
|
|||
}
|
||||
|
||||
const getBasin = function(r, p, e) {
|
||||
while (p) {
|
||||
while (p && r !== p && r !== e) {
|
||||
const parent = pack.rivers.find(r => r.i === p);
|
||||
if (parent) r = parent.i;
|
||||
p = parent ? parent.parent : 0;
|
||||
if (r === e) return r;
|
||||
if (!parent) return r;
|
||||
r = parent.i;
|
||||
p = parent.parent;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue