v1.5.276 - libs minification

This commit is contained in:
Azgaar 2021-02-14 16:49:35 +03:00
parent 1a2eb2291a
commit 71ca7a1166
17 changed files with 24 additions and 1226 deletions

View file

@ -910,7 +910,7 @@
const generateProvinces = function(regenerate) {
TIME && console.time("generateProvinces");
const localSeed = regenerate ? Math.floor(Math.random() * 1e9).toString() : seed;
Math.seedrandom(localSeed);
Math.random = aleaPRNG(localSeed);
const cells = pack.cells, states = pack.states, burgs = pack.burgs;
const provinces = pack.provinces = [0];
@ -928,7 +928,7 @@
}
// generate provinces for a selected burgs
Math.seedrandom(localSeed);
Math.random = aleaPRNG(localSeed);
states.forEach(s => {
s.provinces = [];
if (!s.i || s.removed) return;

View file

@ -388,14 +388,9 @@
if (cells.s[e] > 0) cells.culture[e] = c; // assign culture to populated cell
cost[e] = totalCost;
queue.queue({e, p:totalCost, c});
//debug.append("text").attr("x", (cells.p[n][0]+cells.p[e][0])/2 - 1).attr("y", (cells.p[n][1]+cells.p[e][1])/2 - 1).text(rn(totalCost-p)).attr("font-size", .8);
//const points = [cells.p[n][0], cells.p[n][1], (cells.p[n][0]+cells.p[e][0])/2, (cells.p[n][1]+cells.p[e][1])/2, cells.p[e][0], cells.p[e][1]];
//debug.append("polyline").attr("points", points.toString()).attr("marker-mid", "url(#arrow)").attr("opacity", .6);
}
});
}
//debug.selectAll(".text").data(cost).enter().append("text").attr("x", (d, e) => cells.p[e][0]-1).attr("y", (d, e) => cells.p[e][1]-1).text(d => d ? rn(d) : "").attr("font-size", 2);
TIME && console.timeEnd('expandCultures');
}

View file

@ -6,7 +6,7 @@
const generate = function(changeHeights = true) {
TIME && console.time('generateRivers');
Math.seedrandom(seed);
Math.random = aleaPRNG(seed);
const cells = pack.cells, p = cells.p, features = pack.features;
// build distance field in cells from water (cells.t)
@ -250,7 +250,7 @@
const specify = function() {
if (!pack.rivers.length) return;
Math.seedrandom(seed);
Math.random = aleaPRNG(seed);
const smallLength = pack.rivers.map(r => r.length||0).sort((a,b) => a-b)[Math.ceil(pack.rivers.length * .15)];
const smallType = {"Creek":9, "River":3, "Brook":3, "Stream":1}; // weighted small river types

View file

@ -475,7 +475,7 @@ function toggleIce(event) {
function drawIce() {
const cells = grid.cells, vertices = grid.vertices, n = cells.i.length, temp = cells.temp, h = cells.h;
const used = new Uint8Array(cells.i.length);
Math.seedrandom(seed);
Math.random = aleaPRNG(seed);
const shieldMin = -6; // max temp to form ice shield (glacier)
const icebergMax = 2; // max temp to form an iceberg

View file

@ -389,7 +389,7 @@ function applyStoredOptions() {
// randomize options if randomization is allowed (not locked or options='default')
function randomizeOptions() {
Math.seedrandom(seed); // reset seed to initial one
Math.random = aleaPRNG(seed); // reset seed to initial one
const randomize = new URL(window.location.href).searchParams.get("options") === "default"; // ignore stored options
// 'Options' settings

View file

@ -97,7 +97,8 @@ function recalculatePopulation() {
}
function regenerateStates() {
Math.seedrandom(Math.floor(Math.random() * 1e9)); // new random seed
const localSeed = Math.floor(Math.random() * 1e9); // new random seed
Math.random = aleaPRNG(localSeed);
const burgs = pack.burgs.filter(b => b.i && !b.removed);
if (!burgs.length) {
tip("No burgs to generate states. Please create burgs first", false, "error");