diff options
-rw-r--r-- | lib.ts | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -141,11 +141,14 @@ export default class UICVehicle<Operator extends string | null, Country extends public toString() { const cc = this.country?.uicIdentifier ?? this.countryCode; const ccstr = (this.country?.treatyShort ?? UICCountry.countryMaps.byUICIdentificationNumber.get(this.countryCode!)?.treatyShort ?? null) - // Separation of first character of vehicleFamily for is typically done in Switzerland for SBB and BLS (although not Thurbo?) for their EMUs (first digit often signifying wagon, 0 for entire vehicle) - and not in germany, unsure about elsewhere - return `${this.vehicleType} ${cc} ${cc === '85' && [ - // TODO: figure out if 5 is a reserved prefix (if so, where is it specified) for EMUs - '500', '501', '502', '503', '510', '511', '512', '514', '515', '520', '521', '522', '523', '524', '525', '526', '528', '535', '565', '566' - ].includes(this.vehicleFamily.substring(1)) ? `${this.vehicleFamily.charAt(1) + ' ' + this.vehicleFamily.substring(1)}` : this.vehicleFamily} ${this.serialNumber} ${this.getSelfCheckDigit()}${ccstr && this.operator ? ` ${ccstr}-${this.operator}` : ''}` + return `${this.vehicleType} ${cc} ${cc === '85' && + // Separation of first character of vehicleFamily for is typically done in Switzerland for SBB and BLS (although not Thurbo?) for their EMUs (first digit often signifying wagon, 0 for entire vehicle) - and not in germany, unsure about elsewhere + [ + // TODO: figure out if 5 is a reserved prefix (if so, where is it specified) for EMUs + '500', '501', '502', '503', '510', '511', '512', '514', '515', '520', '521', '522', '523', '524', '525', '526', '528', '535', '565', '566' + ].includes(this.vehicleFamily.substring(1)) ? `${this.vehicleFamily.charAt(1) + ' ' + this.vehicleFamily.substring(1)}` : + // FIXME: if cc==='85' and this is a DPZ, DPZplus, etc..., it is split in the middle, separated by a dash. + this.vehicleFamily} ${this.serialNumber} ${this.getSelfCheckDigit()}${ccstr && this.operator ? ` ${ccstr}-${this.operator}` : ''}` } public toJSON() { return { |