+<h1>Results</h1>
+
+<%perl>
+#========== result computations ==========
+
+#---------- result computation - textstring ----------
+if (!$a{Dropdowns}) {
+ if (length $routestring) {
+ my $rsr= $m->comp('routetextstring',
+ ocean => $a{Ocean},
+ string => $routestring,
+ format => 'return'
+ );
+ if (length $rsr->{Error}) {
+ print encode_entities($rsr->{Error});
+ } else {
+ foreach my $entry (@{ $rsr->{Results} }) {
+ push @archipelagoes,
+ defined $entry->[1] ? undef : $entry->[0];
+ push @islandids, $entry->[1];
+ }
+ }
+ }
+
+} else { #---------- results - dropdowns ----------
+
+my $argorundef= sub {
+ my ($dd,$base) = @_;
+ my $thing= $ARGS{"${base}${dd}"};
+ $thing= undef if defined $thing and $thing eq 'none';
+ return $thing;
+};
+
+for my $dd (0..$a{Dropdowns}-1) {
+ my $arch= &$argorundef($dd,'archipelago');
+ my $island= &$argorundef($dd,'islandid');
+ next unless defined $arch or defined $island;
+ if (defined $island and defined $arch) {
+ my $ii= $islandid2{$island};
+ my $iarch= $ii->{Arch};
+ if ($iarch ne $arch) {
+</%perl>
+ Specified archipelago <% $arch %> but
+ island <% $ii->{Name} %>
+ which is in <% $iarch %>; using the island.<br>
+<%perl>
+ }
+ $arch= undef;
+ }
+ push @archipelagoes, $arch;
+ push @islandids, $island;
+}
+
+}#---------- result processing, common stuff
+</%perl>
+
+% if (@islandids) {
+
+<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &>
+
+% }
+