X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetrade;h=4885782e58a440b7a773510a049daf363e5e0838;hb=66482684911b5a12a5182797de54a24c2b31c29a;hp=7d112b730ae480e938db46648d28038d4b1cf443;hpb=981103caa156882eb0728ffd99f86ca9e29c7887;p=ypp-sc-tools.db-live.git diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 7d112b7..4885782 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -575,6 +575,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( % WHERE islandid = ?'); % my %da_ages; % my $total_total= 0; +% my $total_dist= 0; %

Voyage trading plan

@@ -583,11 +584,13 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( +- <% $this_dist |h %> leagues % } <%perl> my $age_reported= 0; @@ -695,7 +698,7 @@ $addcols->({ Total => 0, DoReverse => 1 }, qw( } -
% $iquery->execute($islandids[$i]); % my ($islandname) = $iquery->fetchrow_array(); +% my $this_dist= $distance->($islandids[$i-1],$islandids[$i]); +% $total_dist += $this_dist; % if (!$i) { Start at <% $islandname |h %> % } else { Sail to <% $islandname |h %> -- <% $distance->($islandids[$i-1],$islandids[$i]) |h %>leagues
+Total distance: <% $total_dist %> leagues. Overall net cash flow <% $total_total < 0 ? -$total_total." loss" : $total_total." gain"