From 299b8dba775c389e3a53694793726957fe708bb5 Mon Sep 17 00:00:00 2001 From: "hieda_kyuko@hpr" <ugo58956@protonmail.com> Date: Wed, 7 May 2025 15:32:53 +0200 Subject: [PATCH] Correctly construct station index --- src/oud2_parser.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/oud2_parser.pl b/src/oud2_parser.pl index 03bbd50..c083680 100644 --- a/src/oud2_parser.pl +++ b/src/oud2_parser.pl @@ -265,6 +265,7 @@ foreach my $frame (values %{ $master{'rosen'} }) { my @old_ekis = @{ $frame->{'eki'} }; my @new_ekis; + my %dict; my @new_refs; my $index = 0; my $update_index = 1; @@ -279,7 +280,7 @@ foreach my $frame (values %{ $master{'rosen'} }) # Run all similarity checks first # Station occurs twice on the same route (branch line) - foreach my $old (@new_ekis) + foreach my $old (values @new_ekis) { if ($old->{'ekimei'} eq $ekimei) { @@ -300,6 +301,7 @@ foreach my $frame (values %{ $master{'rosen'} }) my $id = $frame->{'id'} . "_$index"; print "Adding station $ekimei to master frame with id $id\n"; + $master{'eki_index'}{$id} = \%new_struct; $new_struct{'ekimei'} = $ekimei; $new_struct{'found_in'} = $frame->{'id'}; @@ -312,8 +314,4 @@ foreach my $frame (values %{ $master{'rosen'} }) # Replace old station structures with references # The order is conserved so there's no need to modify {'jikoku'} in {'dia'} $frame->{'eki'} = \@new_ekis; - - push @master_ekis, @new_ekis; } - -$master{'eki_index'} = \@master_ekis; -- GitLab