diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-08-26 06:02:38 +0200 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-08-26 06:02:38 +0200 |
commit | 42e9b67f1667022d3eafb33f44d5c7e6f16246cf (patch) | |
tree | 637113c2c2085132019ada2ff3edfb28cb7f2a93 | |
parent | b990b22a4d82a6da5b37afbd356b1755c1230364 (diff) |
Allow setting mot bitmasks directly
-rw-r--r-- | lib/Travel/Routing/DE/HAFAS.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm index 584a3a3..62ec34c 100644 --- a/lib/Travel/Routing/DE/HAFAS.pm +++ b/lib/Travel/Routing/DE/HAFAS.pm @@ -237,13 +237,23 @@ sub mot_mask { if ( my @mots = @{ $self->{exclusive_mots} // [] } ) { $mot_mask = 0; for my $mot (@mots) { - $mot_mask |= 1 << $mot_pos{$mot}; + if ( exists $mot_pos{$mot} ) { + $mot_mask |= 1 << $mot_pos{$mot}; + } + elsif ( $mot =~ m{ ^ \d+ $ }x ) { + $mot_mask |= 1 << $mot; + } } } if ( my @mots = @{ $self->{excluded_mots} // [] } ) { for my $mot (@mots) { - $mot_mask &= ~( 1 << $mot_pos{$mot} ); + if ( exists $mot_pos{$mot} ) { + $mot_mask &= ~( 1 << $mot_pos{$mot} ); + } + elsif ( $mot =~ m{ ^ \d+ $ }x ) { + $mot_mask &= ~( 1 << $mot ); + } } } |