From d5d5588d0941eb31ecf89b04b6a8ebc72667d2be Mon Sep 17 00:00:00 2001 From: scamiv <6170744+scamiv@users.noreply.github.com> Date: Sat, 22 Nov 2025 21:30:33 +0100 Subject: [PATCH] reduce routing table max distance --- src/core/game/TrainStation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/game/TrainStation.ts b/src/core/game/TrainStation.ts index 3e7c890ce..2c4edfed1 100644 --- a/src/core/game/TrainStation.ts +++ b/src/core/game/TrainStation.ts @@ -156,7 +156,7 @@ export class TrainStation { private routesChanged: boolean = false; private changedRoutes: Set = new Set(); - private readonly maxHops: number = 20; + private readonly maxRoutingEntrieDistance: number = 10; private readonly routeStaleThreshold: number = 500; // ticks private readonly trainSearchRadius = 1; // Search up to x hops away for optimal routes through neighbors // Disabling broadcasts turns routing into local-only mode! @@ -334,7 +334,7 @@ export class TrainStation { const destTile = destination.tile(); const route = this.routingTable.get(destTile); - if (route && route.hopCount <= this.maxHops) { + if (route && route.hopCount <= this.maxRoutingEntrieDistance) { const timeSinceUpdate = this.mg.ticks() - route.lastUpdate; if (timeSinceUpdate <= this.routeStaleThreshold) { return StationLookup.getStation(route.nextHopId); @@ -412,7 +412,7 @@ export class TrainStation { const newHopCount = route.hopCount + 1; // Skip if hop count would be too high - if (newHopCount > this.maxHops) continue; + if (newHopCount > this.maxRoutingEntrieDistance) continue; const existingRoute = this.routingTable.get(destId);