diff --git a/index.css b/index.css index b8572a14..f1159de9 100644 --- a/index.css +++ b/index.css @@ -190,6 +190,12 @@ a { #cults { stroke-linejoin: round; fill-rule: evenodd; +} + +#statesBody, +#provincesBody, +#relig, +#cults { mask: url(#land); } diff --git a/modules/river-generator.js b/modules/river-generator.js index f090616a..a17cff87 100644 --- a/modules/river-generator.js +++ b/modules/river-generator.js @@ -33,11 +33,12 @@ window.Rivers = (function () { function drainWater() { const MIN_FLUX_TO_FORM_RIVER = 30; const prec = grid.cells.prec; + const area = pack.cells.area; const land = cells.i.filter(i => h[i] >= 20).sort((a, b) => h[b] - h[a]); const lakeOutCells = Lakes.setClimateData(h); land.forEach(function (i) { - cells.fl[i] += prec[cells.g[i]]; // add flux from precipitation + cells.fl[i] += prec[cells.g[i]] * area[i] / 100; // add flux from precipitation // create lake outlet if lake is not in deep depression and flux > evaporation const lakes = lakeOutCells[i] ? features.filter(feature => i === feature.outCell && feature.flux > feature.evaporation) : []; diff --git a/modules/ui/tools.js b/modules/ui/tools.js index 8783fded..643cf8ac 100644 --- a/modules/ui/tools.js +++ b/modules/ui/tools.js @@ -117,6 +117,7 @@ function regenerateRivers() { Lakes.defineGroup(); Rivers.specify(); if (!layerIsOn("toggleRivers")) toggleRivers(); + else drawRivers(); } function recalculatePopulation() { diff --git a/modules/voronoi.js b/modules/voronoi.js index f5e4b45c..19581c9d 100644 --- a/modules/voronoi.js +++ b/modules/voronoi.js @@ -2,7 +2,7 @@ class Voronoi { /** * Creates a Voronoi diagram from the given Delaunator, a list of points, and the number of points. The Voronoi diagram is constructed using (I think) the {@link https://en.wikipedia.org/wiki/Bowyer%E2%80%93Watson_algorithm |Bowyer-Watson Algorithm} * The {@link https://github.com/mapbox/delaunator/ |Delaunator} library uses {@link https://en.wikipedia.org/wiki/Doubly_connected_edge_list |half-edges} to represent the relationship between points and triangles. - * @param {{triangles: Uint32Array, halfedges: Int32Array}} delaunay A {@link https://github.com/mapbox/delaunator/blob/master/index.js |Delaunator} instance. + * @param {{triangles: Uint32Array, halfedges: Int32Array}} delaunay A {@link https://github.com/mapbox/delaunator/blob/master/index.js |Delaunator} instance. * @param {[number, number][]} points A list of coordinates. * @param {number} pointsN The number of points. */ @@ -15,7 +15,7 @@ class Voronoi { // Half-edges are the indices into the delaunator outputs: // delaunay.triangles[e] gives the point ID where the half-edge starts - // delaunay.triangles[e] returns either the opposite half-edge in the adjacent triangle, or -1 if there's not an adjacent triangle. + // delaunay.halfedges[e] returns either the opposite half-edge in the adjacent triangle, or -1 if there's not an adjacent triangle. for (let e = 0; e < this.delaunay.triangles.length; e++) { const p = this.delaunay.triangles[this.nextHalfedge(e)]; @@ -132,4 +132,4 @@ class Voronoi { Math.floor(1 / D * (ad * (cx - bx) + bd * (ax - cx) + cd * (bx - ax))) ]; } -} \ No newline at end of file +}