World airport dataset + distance cap on generated jobs (ISS-079, v0.44.0)
CI / build + unit + e2e (pull_request) Successful in 11m2s
CI / build + unit + e2e (pull_request) Successful in 11m2s
This commit is contained in:
+15
-2
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user