mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: generate provinces end
This commit is contained in:
parent
2c35122bb8
commit
4dc5648310
4 changed files with 8 additions and 7 deletions
|
|
@ -69,8 +69,8 @@ async function generate(options?: IGenerationOptions) {
|
|||
// renderLayer("biomes");
|
||||
renderLayer("burgs");
|
||||
renderLayer("routes");
|
||||
renderLayer("states");
|
||||
// renderLayer("religions");
|
||||
// renderLayer("states");
|
||||
renderLayer("provinces");
|
||||
|
||||
// pack.cells.route.forEach((route, index) => {
|
||||
// if (route === 2) drawPoint(pack.cells.p[index], {color: "black"});
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ export function generateProvinces(
|
|||
cultures: TCultures,
|
||||
features: TPackFeatures,
|
||||
cells: Pick<IPack["cells"], "i" | "c" | "h" | "t" | "f" | "culture" | "state" | "burg">
|
||||
) {
|
||||
): {provinceIds: Uint16Array; provinces: TProvinces} {
|
||||
TIME && console.time("generateProvinces");
|
||||
|
||||
const percentage = getInputNumber("provincesInput");
|
||||
if (states.length < 2 || percentage === 0)
|
||||
return {provinceIds: new Uint16Array(cells.i.length), provinces: [] as TProvinces[]};
|
||||
if (states.length < 2 || percentage === 0) return {provinceIds: new Uint16Array(cells.i.length), provinces: [0]};
|
||||
|
||||
const coreProvinces = generateCoreProvinces(states, burgs, cultures, percentage);
|
||||
const provinceIds = expandProvinces(percentage, coreProvinces, cells);
|
||||
|
|
@ -31,7 +30,7 @@ export function generateProvinces(
|
|||
cells
|
||||
}); // mutates provinceIds
|
||||
|
||||
const provinces = [...coreProvinces, ...wildProvinces];
|
||||
const provinces: TProvinces = [0, ...coreProvinces, ...wildProvinces];
|
||||
|
||||
TIME && console.timeEnd("generateProvinces");
|
||||
return {provinceIds, provinces};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue