Skip to content

Commit 88464d1

Browse files
committed
style: fix Biome formatting errors
Expand single-line statements that exceed line length limits to multi-line format across burgs, provinces, river, and routes generators.
1 parent e2e9f1f commit 88464d1

4 files changed

Lines changed: 36 additions & 13 deletions

File tree

src/modules/burgs-generator.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ class BurgModule {
110110

111111
// shift non-port river burgs a bit
112112
for (const burg of burgs) {
113-
if (!burg.i || burg.lock || burg.port || burg.flying || !cells.r[burg.cell]) continue;
113+
if (
114+
!burg.i ||
115+
burg.lock ||
116+
burg.port ||
117+
burg.flying ||
118+
!cells.r[burg.cell]
119+
)
120+
continue;
114121
const cellId = burg.cell;
115122
const shift = Math.min(cells.fl[cellId] / 150, 1);
116123
burg.x = cellId % 2 ? rn(burg.x + shift, 2) : rn(burg.x - shift, 2);
@@ -288,7 +295,8 @@ class BurgModule {
288295

289296
const totalTarget = getTownsNumber();
290297
const targetCount = Math.floor(totalTarget * 0.07);
291-
const baseSpacing = (graphWidth + graphHeight) / 150 / (totalTarget ** 0.5 / 20);
298+
const baseSpacing =
299+
(graphWidth + graphHeight) / 150 / (totalTarget ** 0.5 / 20);
292300
let added = 0;
293301

294302
for (let i = 0; i < sorted.length && added < targetCount; i++) {
@@ -332,7 +340,8 @@ class BurgModule {
332340

333341
const totalTarget = getTownsNumber();
334342
const targetCount = Math.floor(totalTarget * 0.12);
335-
const baseSpacing = (graphWidth + graphHeight) / 150 / (totalTarget ** 0.6 / 30);
343+
const baseSpacing =
344+
(graphWidth + graphHeight) / 150 / (totalTarget ** 0.6 / 30);
336345
let added = 0;
337346

338347
for (let i = 0; i < sorted.length && added < targetCount; i++) {
@@ -375,8 +384,9 @@ class BurgModule {
375384
const sorted = populatedCells.sort((a, b) => score[b] - score[a]);
376385

377386
const totalTarget = getTownsNumber();
378-
const targetCount = Math.floor(totalTarget * 0.20);
379-
const baseSpacing = (graphWidth + graphHeight) / 150 / (totalTarget ** 0.65 / 15);
387+
const targetCount = Math.floor(totalTarget * 0.2);
388+
const baseSpacing =
389+
(graphWidth + graphHeight) / 150 / (totalTarget ** 0.65 / 15);
380390
let added = 0;
381391

382392
for (let pass = 0; added < targetCount && pass < 3; pass++) {
@@ -388,7 +398,11 @@ class BurgModule {
388398
const culture = cells.culture[cell];
389399
const cultureType = pack.cultures[culture]?.type || "Generic";
390400
const spacingMod = this.getCultureSpacingModifier(cultureType);
391-
const spacing = baseSpacing * spacingMod * gauss(1, 0.3, 0.2, 1.5, 2) * (1 / (pass + 1));
401+
const spacing =
402+
baseSpacing *
403+
spacingMod *
404+
gauss(1, 0.3, 0.2, 1.5, 2) *
405+
(1 / (pass + 1));
392406

393407
if (burgsQuadtree.find(x, y, spacing) !== undefined) continue;
394408

src/modules/provinces-generator.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ class ProvinceModule {
131131
if (stateBurgs.length < 2) return; // at least 2 provinces are required
132132

133133
const provincesNumber = Math.min(
134-
Math.max(
135-
Math.ceil((stateBurgs.length * provincesRatio) / 100),
136-
2,
137-
),
134+
Math.max(Math.ceil((stateBurgs.length * provincesRatio) / 100), 2),
138135
20, // cap at max 20 provinces per state
139136
);
140137
const form = Object.assign({}, this.forms[s.form!]);

src/modules/river-generator.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,20 @@ class RiverModule {
132132
let minH = Infinity;
133133
for (const c of cells.c[i]) {
134134
if (lakeIds.has(cells.f[c])) continue;
135-
if (h[c] < minH) { minH = h[c]; minCell = c; }
135+
if (h[c] < minH) {
136+
minH = h[c];
137+
minCell = c;
138+
}
136139
}
137140
} else if (cells.haven[i]) {
138141
minCell = cells.haven[i];
139142
} else {
140143
let minH = Infinity;
141144
for (const c of cells.c[i]) {
142-
if (h[c] < minH) { minH = h[c]; minCell = c; }
145+
if (h[c] < minH) {
146+
minH = h[c];
147+
minCell = c;
148+
}
143149
}
144150
}
145151

src/modules/routes-generator.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,13 @@ const suffixes: Record<string, Record<string, number>> = {
178178
roads: { road: 7, route: 3, way: 2, highway: 1 },
179179
trails: { trail: 4, path: 1, track: 1, pass: 1 },
180180
searoutes: { "sea route": 5, lane: 2, passage: 1, seaway: 1 },
181-
airroutes: { "sky route": 3, "air lane": 2, skyway: 2, airway: 2, "aerial path": 1 },
181+
airroutes: {
182+
"sky route": 3,
183+
"air lane": 2,
184+
skyway: 2,
185+
airway: 2,
186+
"aerial path": 1,
187+
},
182188
};
183189

184190
export interface Route {

0 commit comments

Comments
 (0)