chiark / gitweb /
WIP class and ordering data fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Oct 2009 18:36:27 +0000 (18:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Oct 2009 18:36:27 +0000 (18:36 +0000)
yarrg/Commods.pm
yarrg/source-info.txt

index a405f75..74c52f0 100644 (file)
@@ -98,7 +98,7 @@ our (%pctb_commodmap,@pctb_commodmap);
 my %colours; # eg $colours{'c'}{'black'}= $sources
 my (@rawcm, @nocm); # eg $rawcm[0]='fine rum'; $rawcm[1]='fine %c cloth'
 
-my %colour_ordvals; # $colour_ordvals{'green'}= '30';
+my %colour_ordvals; # $colour_ordvals{'c'}{'green'}= '30';
 my %commodclasses; # $commodclasses{'dye'}= '3';
 
 # IMPORTANT
@@ -121,7 +121,7 @@ sub parse_info1 ($$$) {
            my $colourkind= $1;
            @ctx= (sub {
                m/^(\S[^\t@]+\S)(?:\t+\@(\d+))?$/ or die;
-               my ($colour,$order)=$1;
+               my ($colour,$order)=($1,$2);
                $colours{$colourkind}{$colour} .= $src;
                $colour_ordvals{$colourkind}{$colour}= $order
                    if defined $order;
@@ -191,7 +191,7 @@ sub parse_info1 ($$$) {
     my $ca;
     $ca= sub {
        my ($s,$ss,$ordbase) = @_;
-#print "ca($s)\n";
+#print STDERR "ca($s,,".(defined $ordbase ? $ordbase : '?').")\n";
        if ($s !~ m/\%(\w+)/) {
            my ($name, $props) = $s =~
                /^(\S[^\t]*\S)(?:\t+(\S.*\S))?$/
@@ -210,7 +210,7 @@ sub parse_info1 ($$$) {
                } elsif ($prop =~ m/^\*([-a-z]+)$/) {
                    $c->{Class}= $1;
                    die "$1" unless exists $commodclasses{$1};
-                   $ordclassval= $commodclasses{$1} * 10000;
+                   $ordclassval= $commodclasses{$1} * 1000000;
                } elsif ($prop =~ m/^\@(\d+)$/) {
                    $ordval= $1;
                } else {
@@ -218,18 +218,18 @@ sub parse_info1 ($$$) {
                }
            }
            if (defined $ordbase && defined $ordval && defined $ordclassval) {
-               $ordval += $ordbase + $ordval + $ordclassval;
-               $c->{Ordval}= $ordval;
-#print STDERR "ordval $name $ordval\n";
+               my $ordvalout= $ordbase + $ordval + $ordclassval;
+               $c->{Ordval}= $ordvalout;
+print STDERR "ordval $ordvalout $name OV=$ordval OB=$ordbase OCV=$ordclassval\n";
            } else {
-#print STDERR "ordval $name NONE\n";
+print STDERR "ordval NONE $name\n";
             }
            return;
        }
        die "unknown $&" unless defined $colours{$1};
        my ($lhs,$pctlet,$rhs)= ($`,$1,$');
        foreach my $c (keys %{ $colours{$pctlet} }) {
-           my $ordcolour= $colour_ordvals{$c};
+           my $ordcolour= $colour_ordvals{$pctlet}{$c};
            &$ca($lhs.$c.$rhs,
                 $ss .'%'. $colours{$pctlet}{$c},
                 defined($ordbase) && defined($ordcolour)
index 9a33278..a286376 100644 (file)
@@ -85,33 +85,37 @@ nocommods
  yellow
 
 commods
- %g gems               10kg            *forageables
- diamonds              10kg            *forageables
- emeralds              10kg            *forageables
- moonstones            10kg            *forageables
- opals                 10kg            *forageables
- pearls                        10kg            *forageables
- rubies                        10kg            *forageables
- sapphires             10kg            *forageables
- topazes               10kg            *forageables
+ %g gems               10kg            *forageables    @0
+ diamonds              10kg            *forageables    @9200
+ emeralds              10kg            *forageables    @9210
+ moonstones            10kg            *forageables    @9220
+ opals                 10kg            *forageables    @9230
+ pearls                        10kg            *forageables    @9240
+ rubies                        10kg            *forageables    @9250
+ sapphires             10kg            *forageables    @9260
+ topazes               10kg            *forageables    @9270
 
 %g
- amber
- amethyst
- beryl
- coral
- jade
- jasper
- jet
- lapis lazuli
- quartz
- tigereye
+ amber                                                 @9100
+ amethyst                                              @9110
+ beryl                                                 @9120
+ coral                                                 @9130
+ jade                                                  @9140
+ jasper                                                        @9150
+ jet                                                   @9160
+ lapis lazuli                                          @9170
+ quartz                                                        @9180
+ tigereye                                              @9190
 
 commods
  swill                 1kg             *ship-supplies @10
  grog                  1kg             *ship-supplies @20
  fine rum              1kg             *ship-supplies @30
 
+ small cannon balls    7100g           *ship-supplies @60
+ medium cannon balls   14200g 2l       *ship-supplies @70
+ large cannon balls    21300g 3l       *ship-supplies @80
+
  broom flower          200g            *herbs
  butterfly weed                100g            *herbs
  cowslip               700g            *herbs
@@ -152,10 +156,6 @@ commods
  tellurium             6200g           *minerals
  thorianite            100g            *minerals
 
- small cannon balls    7100g           *ship-supplies @60
- medium cannon balls   14200g 2l       *ship-supplies @70
- large cannon balls    21300g 3l       *ship-supplies @80
-
  hemp                  125kg 250l      *basic-commodities
  hemp oil              1kg             *basic-commodities
  iron                  7800g           *basic-commodities