return if @v <= $c;
my ($price,$qty) = @v[$c..$c+1];
return if !length($price) && !length($qty);
+ die "$price ?" unless $price =~ m/^\d/;
die "$_ ?" unless length($price) && length($qty);
$commod{$commod}{$bs}{$stall}= {
Stall => $stall,
chomp;
@v= split /\t/;
#print STDERR "[".join("|",@v)."]\n";
+ foreach (@v[2..$#v]) {
+ s/\,//g;
+ die "$_ ?" if m/.\D/;
+ }
($commod,$stall) = @v;
push @commods_inorder, $commod unless exists $commod{$commod};
bs_read(Buy, 2);
}
}
-sub write_tsv ($) {
- my ($f) = @_;
+sub write_tsv ($$) {
+ my ($f,$showhold) = @_;
foreach $commod (sort keys %commod) {
$current= $commod{$commod};
my %stalls;
printf($f "%s\t%s", $commod, $stall) or die $!;
bs_p_tsv($f, Buy);
bs_p_tsv($f, Sell);
+ if ($showhold && $commod{$commod}{Hold}) {
+ printf($f "\t%s", $commod{$commod}{Hold}) or die $!;
+ }
print($f "\n") or die $!;
}
}
}
sub main__tsv () {
- write_tsv(\*STDOUT);
+ write_tsv(\*STDOUT,1);
}
sub undef_printable { my ($ov)= @_; defined $ov ? $ov : '?'; };
$o{'timestamp'}= $ENV{'YPPSC_DATA_TIMESTAMP'} or die;
my $tf= pipethrough_prep();
- write_tsv($tf);
+ write_tsv($tf,0);
my $oz= pipethrough_run_gzip($tf);
$o{'data'}= [ undef, 'deduped.tsv.gz',
Content_Type => 'application/octet-stream',
my $islandid;
while ($resptxt =~
- m/^islands\[\d+\]\[\d+\]\=new\s+option\(\"(.*)\"\,(\d+)\)\s*$/mig
+ m/^islands\[(\d+)\]\[\d+\]\=new\s+option\(\"(.*)\"\,(\d+)\)\s*$/mig
) {
- next unless $1 eq $island;
- $islandid= $2;
+ next unless $1 eq $oceanids[0];
+ next unless $2 eq $island;
+ $islandid= $3;
}
defined $islandid or die;
die "@filenames ?" if grep { $_ ne $filename } @filenames;
die "@forcerls ?" if grep { $_ ne $forcerl } @forcerls;
- my $setisland= {
- };
-
print STDERR "Setting ocean and island...\n";
my $siurl= ($url . "?action=setisland".