summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-08-26 20:44:46 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-08-26 20:44:46 +0200
commitf8542fffcd66ceba8ea0114181c942a45d3f8a0d (patch)
tree0bba058187d2017f11f8ee83c5adc2652989bb21 /lib/Travelynx.pm
parent4b6049cd1ae479b8c2c6ea54ae2ae60d2cd20831 (diff)
map, get_travel_distance: Prefer EVA ID over name for route matches2.8.33
Station names frequently change, so the EVA ID is more robust Closes #160
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 4a929f4..6ee21b3 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -2208,10 +2208,16 @@ sub startup {
my @route = @{ $journey->{route} };
- my $from_index
- = first_index { $_->[0] eq $journey->{from_name} } @route;
- my $to_index
- = first_index { $_->[0] eq $journey->{to_name} } @route;
+ my $from_index = first_index {
+ ( $_->[1] and $_->[1] == $journey->{from_eva} )
+ or $_->[0] eq $journey->{from_name}
+ }
+ @route;
+ my $to_index = first_index {
+ ( $_->[1] and $_->[1] == $journey->{to_eva} )
+ or $_->[0] eq $journey->{to_name}
+ }
+ @route;
if ( $from_index == -1 ) {
my $rename = $self->app->renamed_station;