mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 23:57:23 +01:00
refactor: migrate routes (#1294)
Some checks failed
Deploy static content to Pages / deploy (push) Has been cancelled
Code quality / quality (push) Has been cancelled
Some checks failed
Deploy static content to Pages / deploy (push) Has been cancelled
Code quality / quality (push) Has been cancelled
* refactor: migrate routes * refactor: format findPath call for improved readability * refactor: update findPath call to include pack parameter * refactor: optimize route deletion logic in RoutesModule
This commit is contained in:
parent
88c70b9264
commit
454178fa99
7 changed files with 794 additions and 679 deletions
|
|
@ -2,6 +2,7 @@ import type { Burg } from "../modules/burgs-generator";
|
|||
import type { Culture } from "../modules/cultures-generator";
|
||||
import type { PackedGraphFeature } from "../modules/features";
|
||||
import type { River } from "../modules/river-generator";
|
||||
import type { Route } from "../modules/routes-generator";
|
||||
import type { State } from "../modules/states-generator";
|
||||
|
||||
type TypedArray =
|
||||
|
|
@ -21,6 +22,7 @@ export interface PackedGraph {
|
|||
p: [number, number][]; // cell polygon points
|
||||
b: boolean[]; // cell is on border
|
||||
h: TypedArray; // cell heights
|
||||
/** Terrain type */
|
||||
t: TypedArray; // cell terrain types
|
||||
r: TypedArray; // river id passing through cell
|
||||
f: TypedArray; // feature id occupying cell
|
||||
|
|
@ -37,6 +39,7 @@ export interface PackedGraph {
|
|||
religion: TypedArray; // cell religion id
|
||||
state: number[]; // cell state id
|
||||
area: TypedArray; // cell area
|
||||
routes: Record<number, Record<number, number>>;
|
||||
};
|
||||
vertices: {
|
||||
i: number[]; // vertex indices
|
||||
|
|
@ -51,5 +54,6 @@ export interface PackedGraph {
|
|||
burgs: Burg[];
|
||||
states: State[];
|
||||
cultures: Culture[];
|
||||
routes: Route[];
|
||||
religions: any[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ declare global {
|
|||
var rivers: Selection<SVGElement, unknown, null, undefined>;
|
||||
var oceanLayers: Selection<SVGGElement, unknown, null, undefined>;
|
||||
var emblems: Selection<SVGElement, unknown, null, undefined>;
|
||||
var viewbox: Selection<SVGElement, unknown, null, undefined>;
|
||||
var routes: Selection<SVGElement, unknown, null, undefined>;
|
||||
var biomesData: {
|
||||
i: number[];
|
||||
name: string[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue