summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/HAFAS.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-08-26 06:02:38 +0200
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-08-26 06:02:38 +0200
commit42e9b67f1667022d3eafb33f44d5c7e6f16246cf (patch)
tree637113c2c2085132019ada2ff3edfb28cb7f2a93 /lib/Travel/Routing/DE/HAFAS.pm
parentb990b22a4d82a6da5b37afbd356b1755c1230364 (diff)
Allow setting mot bitmasks directly
Diffstat (limited to 'lib/Travel/Routing/DE/HAFAS.pm')
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm14
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 );
+ }
}
}