summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-12-20 16:12:26 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-12-20 16:12:26 +0100
commit67352734864b4387c95de60b4259daf0744263a6 (patch)
treec30cc488f3c8d119869659a425721bff679b1751
parentbb0ff3a9c76afdaafe8269ccf8377b5f68579f6f (diff)
add locomotives to wagon list
-rwxr-xr-xbin/db-wagenreihung-to-json8
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] )