refactor: grid generation

This commit is contained in:
Azgaar 2022-07-11 01:38:55 +03:00
parent d18636eb8f
commit e59b536e83
15 changed files with 157 additions and 105 deletions

20
src/types/grid.d.ts vendored
View file

@ -5,16 +5,26 @@ interface IGrid extends IGraph {
spacing: number;
boundary: TPoints;
points: TPoints;
cells: IGridCells;
cells: IGraphCells & IGridCells;
features: TGridFeatures;
}
interface IGridCells extends IGraphCells {
h: UintArray; // heights, [0, 100], see MIN_LAND_HEIGHT constant
interface IGridCells {
h: Uint8Array; // heights, [0, 100], see MIN_LAND_HEIGHT constant
t: Int8Array; // see DISTANCE_FIELD enum
f: Uint16Array; // feature id, see IGridFeature
temp: UintArray; // temparature in Celsius
prec: UintArray; // precipitation in inner units
temp: Int8Array; // temparature in Celsius
prec: Uint8Array; // precipitation in inner units
}
interface IGridBase extends IGrid {
cells: IGraphCells & Partial<IGridCells>;
features?: TGridFeatures;
}
interface IGridWithHeights extends IGrid {
cells: IGraphCells & Partial<IGridCells> & {h: Uint8Array};
features?: TGridFeatures;
}
type TGridFeatures = [0, ...IGridFeature[]];

View file

@ -6,16 +6,23 @@ interface Navigator {
interface Window {
mapCoordinates: IMapCoordinates;
$: typeof $;
$: typeof $; // jQuery
// untyped IIFE modules
Biomes: typeof Biomes;
Names: typeof Names;
ThreeD: typeof ThreeD;
ReliefIcons: typeof ReliefIcons;
Zoom: typeof Zoom;
Lakes: typeof Lakes;
HeightmapGenerator: typeof HeightmapGenerator;
OceanLayers: typeof OceanLayers;
Biomes: any;
Names: any;
ThreeD: any;
ReliefIcons: any;
Zoom: any;
Lakes: any;
HeightmapGenerator: any;
OceanLayers: any;
Rivers: any;
Cultures: any;
BurgsAndStates: any;
Religions: any;
Military: any;
Markers: any;
}
interface Node {

2
src/types/pack.d.ts vendored
View file

@ -11,7 +11,7 @@ interface IPack extends IGraph {
interface IPackCells extends IGraphCells {
p: TPoints; // cell center points
h: UintArray; // heights, [0, 100], see MIN_LAND_HEIGHT constant
h: Uint8Array; // heights, [0, 100], see MIN_LAND_HEIGHT constant
t: Int8Array; // see DISTANCE_FIELD enum
f: Uint16Array; // feature id, see TPackFeature
g: UintArray;