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
This commit is contained in:
izawartka 2025-07-14 19:27:49 +02:00
parent bb5de115b7
commit 72c3c7f089

View File

@ -112,8 +112,20 @@ export default class ElectrificationResolver {
return; 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 => { track.connections.forEach(connection => {
if (skipTrackId === connection.otherTrackId) return; if (skipTrackId === connection.otherTrackId) return;
if (additionalSkipIds.includes(connection.otherTrackId)) return;
this._propagate(connection.otherTrack, track.id, track.electrificationStatus); this._propagate(connection.otherTrack, track.id, track.electrificationStatus);
}); });
} }