From 72c3c7f089daa8555f2cc6626272ecd4469eefe0 Mon Sep 17 00:00:00 2001 From: izawartka <59137928+izawartka@users.noreply.github.com> Date: Mon, 14 Jul 2025 19:27:49 +0200 Subject: [PATCH] Fixed electrification propagation on switches *Fixed NON_ELECTRIFIED status being propagated back when NEVP is on a track with more than 2 connections coming from >------------[-- NEVP --]----> propagate / don't propagate! <----/ ^ current track with 3 connections --- src/model/electrification-resolver.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/model/electrification-resolver.js b/src/model/electrification-resolver.js index dc83a6c..4be9f1f 100644 --- a/src/model/electrification-resolver.js +++ b/src/model/electrification-resolver.js @@ -112,8 +112,20 @@ export default class ElectrificationResolver { return; } + // only propagate NON_ELECTRIFIED status forward when NEVP is on a track with more than 2 connections + let additionalSkipIds = []; + if(track.hasNEVP && track.connections.length > 2) { + const comingFromConnection = track.connections.find(connection => connection.otherTrackId === skipTrackId) || null; + const comingFromEnd = comingFromConnection?.end || null; + + additionalSkipIds = track.connections + .filter(connection => connection.end === comingFromEnd) + .map(connection => connection.otherTrackId); + } + track.connections.forEach(connection => { if (skipTrackId === connection.otherTrackId) return; + if (additionalSkipIds.includes(connection.otherTrackId)) return; this._propagate(connection.otherTrack, track.id, track.electrificationStatus); }); }