chiark / gitweb /
routesearch: show 15 of each
[ypp-sc-tools.main.git] / yarrg / web / query_routesearch
index 34fbc22e38d25584a078afd1caf05b78ed1b7497..6877536b14b20068ecda828c8a72a7364c58ecc1 100644 (file)
@@ -52,10 +52,13 @@ my $emsg;
 my @warningfs;
 my @islandids;
 
+my $maxmaxdist=35;
+my $maxcpu=90;
+
 my $qa= \%ARGS;
 my $routeparams= { EmsgRef => \$emsg, SayRequiredCapacity => 1 };
 my $maxdist;
-my $maxcountea=10;
+my $maxcountea=15;
 
 </%perl>
 
@@ -94,8 +97,8 @@ This feature is not available from the "drop down menus" interface.
 </form>
 <%perl>
 
-if (!$emsg && $maxdist > 30) {
-       $emsg= "Searching for routes of more than 30 leagues is not".
+if (!$emsg && $maxdist > $maxmaxdist) {
+       $emsg= "Searching for routes of more than $maxmaxdist leagues is not".
                " supported, sorry.";
 }
 
@@ -122,7 +125,7 @@ my $isleinfo = sub {
 
 #---------- compute the results ----------
 
-my @rsargs;
+my @rsargs= qw(-DN);
 
 foreach my $k (qw(MaxMass MaxVolume MaxCapital)) {
        my $v= $routeparams->{$k};
@@ -130,20 +133,19 @@ foreach my $k (qw(MaxMass MaxVolume MaxCapital)) {
 }
 push @rsargs, defined $routeparams->{LossPerLeaguePct}
        ? $routeparams->{LossPerLeaguePct}*0.01 : 1e-9;
-push @rsargs, 'search', $maxcountea,$maxcountea, $maxdist, 'any', @islandids;
+push @rsargs, '0';
+push @rsargs, 'search',$maxdist, $maxcountea,$maxcountea, 'any', @islandids;
 
 m/[^-.0-9a-zA-Z]/ and die "$_ $& ?" foreach @rsargs;
 
-unshift @rsargs, dbw_filename($qa->{'Ocean'});
-unshift @rsargs, qw(-DN);
-
 if ($qa->{'debug'}) {
 </%perl>
 [[ <% "@rsargs" |h %> ]]<br><pre>
 <%perl>
 }
 
-unshift @rsargs, sourcebasedir().'/yarrg/routesearch';
+unshift @rsargs, sourcebasedir().'/yarrg/routesearch',
+       '-d', dbw_filename($qa->{'Ocean'});
 
 my %results; # $results{$ap}{"5 6 9 10"} = { stuff }
 
@@ -152,8 +154,7 @@ my $child= $fh->open("-|"); defined $child or die $!;
 if (!$child) {
        my $cpu= BSD::Resource::RLIMIT_CPU;
        my ($soft,$hard)= getrlimit($cpu);
-       my $max=10;
-       setrlimit($cpu,$max,$hard) or die $! if $soft>$max;
+       setrlimit($cpu,$maxcpu,$hard) or die $! if $hard<=$maxcpu;
        exec @rsargs;
        die $!;
 }
@@ -222,7 +223,7 @@ if ($qa->{'debug'}) {
 <td align=right><% $item->{A} |h %>
 <td align=right><% $item->{P} |h %>
 <td align=left><% join ', ', @{ $item->{Archs} } |h %>
-<td align=left><% $item->{Start} |h %>, 
+<td align=left><% $item->{Start} |h %>,
 <td align=left><% join ' ', map { $_.',' } @{ $item->{Vias} } |h %>
 <td align=left><% $item->{Finish} |h %>
 </td>