7 open CM, "commodmap" or die $!;
9 m/^(\S.*\S)\t(\d+)$/ or die;
14 %stallkinds= qw(A Apothecary
24 $!=0; my $l= <STDIN>; die $! unless defined $l;
25 die $! if STDIN->error;
27 print "GOT FOR $w LINE [$l]\n"
35 my $t= tell STDIN; $t>=0 or die $!;
36 my $r= read STDIN,$b,2; die $! if STDIN->error;
38 my $v= scalar unpack "v", $b;
39 printf "GOT AT 0x%x INT FOR %s VALUE %d 0x%x\n", $t, $w, $v, $v
45 my ($what,$ary,$ix) = @_;
47 return $got if defined $got;
52 printf "# Version: \"%s\"\n", getline("version");
53 $nstalls= getline("nstalls")+0;
55 while (@stalls < $nstalls) {
56 $_= getline("stall name ".(@stalls+1));
59 $sk= $stallkinds{$kind};
60 die "kind $kind in $_ ?" unless defined $sk;
65 unshift @stalls, undef;
69 foreach $bs qw(Buy Sell) {
70 $ncommods= getint("Buy ncommods");
71 for ($commodnum=0; $commodnum<$ncommods; $commodnum++) {
72 $commodix= getint("Buy $commodnum commodix");
73 $offers= getint("Buy $commodnum offers");
74 for ($offernum=0; $offernum<$offers; $offernum++) {
75 $stallix= getint("Buy $commodnum $offernum stallix");
76 $price= getint("Buy $commodnum $offernum price");
77 $qty= getint("Buy $commodnum $offernum qty");
80 inmap('commod',@commodmap,$commodix),
81 inmap('stall',@stalls,$stallix)) or die $!;
82 if ($bs eq 'Sell') { print "\t\t" or die $!; }
83 printf("\t%d\t%d", $price, $qty) or die $!;
84 if ($bs eq 'Buy') { print "\t\t" or die $!; }
91 STDIN->error and die $!;