diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 16:12:26 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 16:12:26 +0100 |
commit | 67352734864b4387c95de60b4259daf0744263a6 (patch) | |
tree | c30cc488f3c8d119869659a425721bff679b1751 | |
parent | bb0ff3a9c76afdaafe8269ccf8377b5f68579f6f (diff) |
add locomotives to wagon list
-rwxr-xr-x | bin/db-wagenreihung-to-json | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/db-wagenreihung-to-json b/bin/db-wagenreihung-to-json index 18d509e..45b9074 100755 --- a/bin/db-wagenreihung-to-json +++ b/bin/db-wagenreihung-to-json @@ -512,10 +512,10 @@ for my $train_number ( keys %map ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { - #push( @{ $type_by_wagon_number{$wagon_number} }, $wagon_type ); + # Locomotives do not have a wagon number. That's OK. next; } - if ( not $wagon_number ) { + elsif ( not $wagon_number ) { $wagon_numbers_ok = 0; } else { @@ -526,11 +526,13 @@ for my $train_number ( keys %map ) { if ($wagon_numbers_ok) { for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; + + push( @{ $map{$train_number}{wagons} }, $wagon ); + if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { next; } - push( @{ $map{$train_number}{wagons} }, $wagon ); if ( $bincount{$wagon_number} > 1 ) { if ( $type_by_wagon_number{$wagon_number}[0] ne $type_by_wagon_number{$wagon_number}[1] ) |