Skip to content

Commit

Permalink
feat: try DVP short platforms for HS1
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Jun 16, 2024
1 parent b8ca366 commit 77eccc2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/data/liveTrains/shortPlatforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,15 @@ const data: Record<
},
},
DVP: {
'1': {
SE: southeasternHs1('front.8', 'front.12'),
},
'2': {
SE: southeasternHs1('front.8', 'front.10'),
},
'3': {
SE: 'front.8',
},
'*': {
SE: 'front.8',
},
Expand Down Expand Up @@ -2161,3 +2170,21 @@ function southernTurboElectro(turboLen: `${'front' | 'middle' | 'rear'}.${number
return electroLen
}
}

function southeasternHs1(nonHs1: `${'front' | 'middle' | 'rear'}.${number}`, hs1: `${'front' | 'middle' | 'rear'}.${number}`) {
return (trainService: TrainService): `${'front' | 'middle' | 'rear'}.${number}` | null => {
const hs1Stations = ['STP', 'EBD', 'SFA', 'ASI', 'AFK']

if (
trainService.origin.some(s => hs1Stations.includes(s.crs)) ||
trainService.destination.some(s => hs1Stations.includes(s.crs)) ||
trainService.origin.some(s => hs1Stations.includes(s.crs)) ||
trainService.destination.some(s => hs1Stations.includes(s.crs)) ||
trainService.subsequentLocations.some(s => hs1Stations.includes(s.crs || ''))
) {
return hs1
}

return nonHs1
}
}

0 comments on commit 77eccc2

Please sign in to comment.