mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Added Logging Options to Improve Performance (#529)
* Added Logging Options to Improve Performance * Requested Changes Co-authored-by: Onyx Azryn <brycekabat@onyxazryn.com>
This commit is contained in:
parent
e480c1c8e5
commit
f4efedcf9d
18 changed files with 192 additions and 186 deletions
|
|
@ -5,7 +5,7 @@
|
|||
}(this, (function () {'use strict';
|
||||
|
||||
const getRoads = function() {
|
||||
console.time("generateMainRoads");
|
||||
TIME && console.time("generateMainRoads");
|
||||
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||
const capitals = burgs.filter(b => b.capital);
|
||||
if (capitals.length < 2) return []; // not enough capitals to build main roads
|
||||
|
|
@ -21,12 +21,12 @@
|
|||
}
|
||||
|
||||
cells.i.forEach(i => cells.s[i] += cells.road[i] / 2); // add roads to suitability score
|
||||
console.timeEnd("generateMainRoads");
|
||||
TIME && console.timeEnd("generateMainRoads");
|
||||
return paths;
|
||||
}
|
||||
|
||||
const getTrails = function() {
|
||||
console.time("generateTrails");
|
||||
TIME && console.time("generateTrails");
|
||||
const cells = pack.cells, burgs = pack.burgs.filter(b => b.i && !b.removed);
|
||||
if (burgs.length < 2) return []; // not enough burgs to build trails
|
||||
|
||||
|
|
@ -55,12 +55,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
console.timeEnd("generateTrails");
|
||||
TIME && console.timeEnd("generateTrails");
|
||||
return paths;
|
||||
}
|
||||
|
||||
const getSearoutes = function() {
|
||||
console.time("generateSearoutes");
|
||||
TIME && console.time("generateSearoutes");
|
||||
const allPorts = pack.burgs.filter(b => b.port > 0 && !b.removed);
|
||||
if (allPorts.length < 2) return [];
|
||||
|
||||
|
|
@ -93,12 +93,12 @@
|
|||
|
||||
});
|
||||
|
||||
console.timeEnd("generateSearoutes");
|
||||
TIME && console.timeEnd("generateSearoutes");
|
||||
return paths;
|
||||
}
|
||||
|
||||
const draw = function(main, small, ocean) {
|
||||
console.time("drawRoutes");
|
||||
TIME && console.time("drawRoutes");
|
||||
const cells = pack.cells, burgs = pack.burgs;
|
||||
lineGen.curve(d3.curveCatmullRom.alpha(0.1));
|
||||
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
return [x, y];
|
||||
})), 1));
|
||||
|
||||
console.timeEnd("drawRoutes");
|
||||
TIME && console.timeEnd("drawRoutes");
|
||||
}
|
||||
|
||||
const regenerate = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue