World airport dataset + distance cap on generated jobs (ISS-079, v0.44.0)
CI / build + unit + e2e (pull_request) Successful in 11m2s

This commit is contained in:
2026-09-21 19:28:44 +00:00
parent 320bdf3b72
commit 3ac7075eb0
15 changed files with 1467 additions and 280 deletions
+15 -2
View File
@@ -12,6 +12,7 @@ import {
generatePackage,
MARKET_TARGET_OPEN_PACKAGES,
mulberry32,
pickDestWithinCap,
type Rng,
type SeedAirport,
} from '@/lib/game/seed';
@@ -371,9 +372,21 @@ export async function spawnCoveragePackages(
let n = 0;
for (const icao of missing) {
if (!airports.some((a) => a.icao === icao)) continue; // defensive — the dataset is the source of all ICACs
const oi = airports.findIndex((a) => a.icao === icao);
if (oi < 0) continue; // defensive — the dataset is the source of all ICACs
// v0.44.0 (ISS-079): cap the random dest at MAX_JOB_LEG_KM like generatePackage's unforced pairs —
// one draw in the same stream position as the old uncapped pick, so downstream draws are unchanged.
const di = pickDestWithinCap(airports, oi, rand);
await inst.db.insert(schema.packages).values(
generatePackage({ id: randomUUID(), airports, rng: rand, nowMs: clockMs, originIcao: icao, reputation: account.reputation }),
generatePackage({
id: randomUUID(),
airports,
rng: rand,
nowMs: clockMs,
originIcao: icao,
...(di >= 0 ? { destIcao: airports[di].icao } : {}), // di < 0 (no within-cap neighbour) → old uncapped behavior
reputation: account.reputation,
}),
);
n++;
}