chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.web-live.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5f3c445
)
show game UI location for commodities in trading plan; UI could be improved
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 5 Nov 2009 17:14:46 +0000
(17:14 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 5 Nov 2009 17:14:46 +0000
(17:14 +0000)
yarrg/web/routetrade
patch
|
blob
|
history
diff --git
a/yarrg/web/routetrade
b/yarrg/web/routetrade
index b198b9b3867ab7cff6ca4fb2150f2b33d037c921..27cf295d19376abb8451f7dbba43f972a7aab100 100644
(file)
--- a/
yarrg/web/routetrade
+++ b/
yarrg/web/routetrade
@@
-140,6
+140,9
@@
my $stmt= "
commods.commodid commodid,
commods.unitmass unitmass,
commods.unitvolume unitvolume,
commods.commodid commodid,
commods.unitmass unitmass,
commods.unitvolume unitvolume,
+ commods.ordval ordval,
+ commods.posinclass posinclass,
+ commods.commodclassid commodclassid,
dist dist,
buy.price - sell.price unitprofit
FROM commods
dist dist,
buy.price - sell.price unitprofit
FROM commods
@@
-635,7
+638,7
@@
Generated by YARRG at <strong><%
%
% foreach my $i (0..$#islandids) {
<% $tbody->(1) %>
%
% foreach my $i (0..$#islandids) {
<% $tbody->(1) %>
-<tr><td colspan=
4
>
+<tr><td colspan=
5
>
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
% if (!$i) {
% $iquery->execute($islandids[$i]);
% my ($islandname) = $iquery->fetchrow_array();
% if (!$i) {
@@
-659,7
+662,7
@@
Generated by YARRG at <strong><%
<%perl>
my $age_reported= 0;
my %flowlists;
<%perl>
my $age_reported= 0;
my %flowlists;
- #print "<tr><td colspan=
6
>" if $qa->{'debug'};
+ #print "<tr><td colspan=
7
>" if $qa->{'debug'};
foreach my $od (qw(org dst)) {
#print " [[ i $i od $od " if $qa->{'debug'};
foreach my $sf (@subflows) {
foreach my $od (qw(org dst)) {
#print " [[ i $i od $od " if $qa->{'debug'};
foreach my $sf (@subflows) {
@@
-673,6
+676,7
@@
Generated by YARRG at <strong><%
my $price= $f->{"${od}_price"};
my $stallname= $f->{"${od}_stallname"};
my $todo= \$flowlists{$od}{
my $price= $f->{"${od}_price"};
my $stallname= $f->{"${od}_stallname"};
my $todo= \$flowlists{$od}{
+ (sprintf "%010d", $f->{'ordval'}),
$f->{'commodname'},
(sprintf "%07d", ($od eq 'dst' ?
9999999-$price : $price)),
$f->{'commodname'},
(sprintf "%07d", ($od eq 'dst' ?
9999999-$price : $price)),
@@
-684,6
+688,20
@@
Generated by YARRG at <strong><%
dstArbitrage => 0,
} unless $$todo;
$$todo->{'commodname'}= $f->{'commodname'};
dstArbitrage => 0,
} unless $$todo;
$$todo->{'commodname'}= $f->{'commodname'};
+ $$todo->{'posinclass'}= '';
+ if ($f->{'posinclass'}) {
+ my $findclass= $dbh->prepare(<<END);
+SELECT commodclass, maxposinclass FROM commodclasses WHERE commodclassid = ?
+END
+ $findclass->execute($f->{'commodclassid'});
+ my $classinfo= $findclass->fetchrow_hashref();
+ $$todo->{'posinclass'}=
+ sprintf "(%s %d/%d)",
+ $classinfo->{'commodclass'},
+ $f->{'posinclass'},
+ $classinfo->{'maxposinclass'}
+ if $classinfo->{'maxposinclass'} > 9;
+ }
$$todo->{'stallname'}= $stallname;
$$todo->{Price}= $price;
$$todo->{Timestamp}= $f->{"${od}_timestamp"};
$$todo->{'stallname'}= $stallname;
$$todo->{Price}= $price;
$$todo->{Timestamp}= $f->{"${od}_timestamp"};
@@
-715,7
+733,7
@@
Generated by YARRG at <strong><%
</%perl>
<tr>
<td colspan=1>
</%perl>
<tr>
<td colspan=1>
-<td colspan=
2
><% $xinfo %>
+<td colspan=
3
><% $xinfo %>
<td colspan=2 align=right><% $totaldesc %>
<td align=right><% $totalwas |h %> total
<%perl>
<td colspan=2 align=right><% $totaldesc %>
<td align=right><% $totalwas |h %> total
<%perl>
@@
-746,6
+764,7
@@
Generated by YARRG at <strong><%
% tr_datarow($m,$dline);
<<% $td %>><% $collectdeliver %>
<<% $td %>><% $t->{'commodname'} |h %>
% tr_datarow($m,$dline);
<<% $td %>><% $collectdeliver %>
<<% $td %>><% $t->{'commodname'} |h %>
+<<% $td %>><% $t->{'posinclass'} |h %>
%
% my @stalls= sort keys %{ $t->{Stalls} };
% my $pstall= sub {
%
% my @stalls= sort keys %{ $t->{Stalls} };
% my $pstall= sub {
@@
-792,7
+811,7
@@
Generated by YARRG at <strong><%
}
</%perl><a name="summary"></a>
<% $tbody->(1) %><tr>
}
</%perl><a name="summary"></a>
<% $tbody->(1) %><tr>
-<td colspan=
2
>Total distance: <% $total_dist %> leagues.
+<td colspan=
3
>Total distance: <% $total_dist %> leagues.
<td colspan=3 align=right>Overall net cash flow
<td align=right><strong><%
$total_total < 0 ? -$total_total." loss" : $total_total." gain"
<td colspan=3 align=right>Overall net cash flow
<td align=right><strong><%
$total_total < 0 ? -$total_total." loss" : $total_total." gain"