chiark / gitweb /
move into misc-data.pl: HS1 array
[pandemic-rising-tide.git] / generate-board
index 484c6492e0fd5e7e3464d895969afc229ff06a59..79c258824ae61ed0272fc1627074594839b60e51 100755 (executable)
@@ -933,9 +933,9 @@ sub dykes(){
   }
 }
 
-sub hs_initial_1 ($;$$$) {
-  my ($colour, $fn) = @_;
-  my $hs1 = $c{HS1}{$colour};
+sub hs_initial_1 ($) {
+  my ($hs1) = @_;
+  my ($colour) = $hs1->{Colour};
   my ($text, $text2);
   if ($hs1->{Water}) {
     ($text,$text2) = ('up to '.$hs1->{Water}, 'fewer');
@@ -951,37 +951,34 @@ sub hs_initial_1 ($;$$$) {
   o("    ".pos_plus_dy_adjunct($c{PA}{HS1_initials})."\n");
   o("    ", ($hs1->{XIYI}[0]*$interval), " ",
            (($hs1->{XIYI}[1]-1)*$interval), " translate\n");
-  if ($fn) {
+  if (defined $text) {
     o("  gsave\n");
     o("        $demo_h setlinewidth 0 0 moveto $demo_w 0 rlineto\n");
     o("        ", facepscolour($colour), " stroke grestore\n");
   }
   one_hs($colour, mkvec(0,0));
-  if ($fn) {
+  if (defined $text) {
     o("    /words {\n");
     o("      2 copy moveto                      ($text) show\n");
     o("      2 copy moveto 0 -$text_sz rmoveto ($text2) show\n");
     o("    } bind def\n");
     o("    gsave ".($hs_sz * 0.8)." $cube_gap translate wordsshow grestore\n");
     o("    $demo_x0 ",($hs_sz * -0.25)," translate\n");
-    $fn->();
   }
-  o("  grestore\n");
-}
-
-sub hs_initial () {
-  hs_initial_1('red');
-  hs_initial_1('purple');
-  hs_initial_1('green', sub {
+  if ($hs1->{Water}) {
     o("    ",(water_cubes_sz(1))," 0 translate\n");
     o("    0 ",(-water_cubes_sz(1) * 0.3)," translate\n");
     water_cubes(1, miscpscolour('edge'));
-  });
-  hs_initial_1('yellow', sub {
+  } elsif ($hs1->{Dykes}) {
     o("    newpath dykepath\n");
     o("    gsave ",miscpscolour('edge')," stroke grestore\n");
     o("    gsave ",miscpscolour('dykehsadd')," fill grestore\n");
-  });
+  }
+  o("  grestore\n");
+}
+
+sub hs_initial () {
+  hs_initial_1($_) foreach @{ $c{HS1} };
 }
 
 sub play_hint () {