From 216e8ca29f90b73220598b046f2ea07a39ccae3c Mon Sep 17 00:00:00 2001 From: Arkadiusz Sygulski Date: Sun, 18 Jan 2026 21:51:22 +0100 Subject: [PATCH] Fix rail pathfinding (#2950) ## Description: This PR resolves a crash related to rail pathfinding reported on Discord. ``` git checkout c179249cdd7439fe132a8f5f7a518b9d0e4698af npm run dev:staging Replay id: kEbHPSP3 ``` ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: moleole Co-authored-by: Claude Opus 4.5 Co-authored-by: Ryan <7389646+ryanbarlow97@users.noreply.github.com> --- src/core/game/RailNetworkImpl.ts | 2 +- src/core/pathfinding/PathFinder.Station.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/game/RailNetworkImpl.ts b/src/core/game/RailNetworkImpl.ts index 711221120..d3aef952b 100644 --- a/src/core/game/RailNetworkImpl.ts +++ b/src/core/game/RailNetworkImpl.ts @@ -23,7 +23,7 @@ export interface StationManager { export class StationManagerImpl implements StationManager { private stations: Set = new Set(); private stationsById: (TrainStation | undefined)[] = []; - private nextId = 0; + private nextId = 1; // Start from 1; 0 is reserved as invalid/sentinel addStation(station: TrainStation) { station.id = this.nextId++; diff --git a/src/core/pathfinding/PathFinder.Station.ts b/src/core/pathfinding/PathFinder.Station.ts index 8510fb048..1efa20be6 100644 --- a/src/core/pathfinding/PathFinder.Station.ts +++ b/src/core/pathfinding/PathFinder.Station.ts @@ -42,7 +42,7 @@ class StationGraphAdapter implements AStarAdapter { } maxNeighbors(): number { - return 8; + return 32; } maxPriority(): number {