if ($specific && !$confusing &&
# With a circular route, do not carry goods round the loop
- !($src_i==0 && $dst_i==$#islandids &&
+ !(($src_i==0 || $src_i==$#islandids) &&
+ $dst_i==$#islandids &&
$src_isle == $islandids[$dst_i])) {
if ($islandpair{$src_isle,$dst_isle}) {
$confusing= 1;
+print "confusing $src_i $src_isle $dst_i $dst_isle\n";
} else {
$islandpair{$src_isle,$dst_isle}=
[ $src_i, $dst_i ];
Route is complex - it visits the same island several times
and isn't a simple loop.
% }
-Therefore, optimal trade pattern not calculated.
+Therefore, optimal voyage trade plan not calculated.
% } else { # ========== OPTMISATION ==========
<%perl>
% }
</table>
-<& tabsort, cols => \@cols, table => 'trades', rowclass => 'datarow',
+<&| tabsort, cols => \@cols, table => 'trades', rowclass => 'datarow',
throw => 'trades_sort', tbrow => 'trades_total' &>
-<&| script &>
ts_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
- function all_onload() {
- ts_onload__trades();
- }
- window.onload= all_onload;
-</&script>
+</&tabsort>
<input type=submit name=update value="Update">
next if $f->{Suppress};
next unless $f->{"${od}_id"} == $islandids[$i];
next unless $f->{OptQty};
+ my $arbitrage= $f->{'org_id'} == $f->{'dst_id'};
+ my $loop= $islandids[0] == $islandids[-1] &&
+ ($i==0 || $i==$#islandids);
+ next if $loop and ($arbitrage ? $i :
+ !!$i == !!($od eq 'org'));
my $price= $f->{"${od}_price"};
my $stallname= $f->{"${od}_stallname"};
my $todo= \$flowlists{$od}{
$$todo->{Qty} += $f->{OptQty};
$$todo->{Total}= $$todo->{Price} * $$todo->{Qty};
$$todo->{Stalls}= $f->{"${od}Stalls"};
- if ($f->{'org_id'} == $f->{'dst_id'}) {
- $$todo->{"${od}Arbitrage"}= 1;
- }
+ $$todo->{"${od}Arbitrage"}= 1 if $arbitrage;
}
}