chiark / gitweb /
move into misc-data.pl: decks, also adjuncts_dy_from_boundings
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Mar 2019 20:16:47 +0000 (20:16 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Mar 2019 20:48:38 +0000 (20:48 +0000)
NFC

generate-board
misc-data.pl

index 109e84dd28dc6bb6489d4526d17b9b2cc90b6945..1cc324280a60cdb0ef2c3ffec89794209e5bfdf2 100755 (executable)
@@ -38,8 +38,7 @@ our $a1_h = 2384;
 our $max_printeredge = 5.50 * MM2PT;
 our $a1m_pasteedge = 3.5 * MM2PT; # along each edge
 our $preamble_from_boundings = '';
-our $top_adjuncts_dy_from_boundings = 0;
-our $bottom_adjuncts_dy_from_boundings = 0;
+our %adjuncts_dy_from_boundings = (Top => 0, Bottom => 0);
 
 # ----- region names from plag, incl. reverse mapping -----
 
@@ -388,8 +387,8 @@ sub computeboundings() {
           -$surroundw 0        rlineto
                  closepath $w_stroke clip
 END
-    ($top_adjuncts_dy_from_boundings,
-     $bottom_adjuncts_dy_from_boundings) = @{ $c{PA}{BoundingsA1dy} };
+    $adjuncts_dy_from_boundings{Top}    = $c{PA}{BoundingsA1dy}[0];
+    $adjuncts_dy_from_boundings{Bottom} = $c{PA}{BoundingsA1dy}[1];
     # ^ if we are doing it all in one go we lose less printable area
   } else {
     confess;
@@ -771,16 +770,22 @@ sub decks(){
   }
   o("    closepath\n");
   o("  } bind def");
+
   o("  /deckpairpathx {\n"); # x because it leaves matrix changed
   o("    newpath         deck1path\n");
   o("    200 0 translate deck1path\n");
   o("  } bind def");
-  o("  $lw setlinewidth ",miscpscolour('playerdeck'),"\n");
-  o("  gsave 401 44 $bottom_adjuncts_dy_from_boundings add translate");
-  o("     deckpairpathx stroke grestore");
-  o("  $lw setlinewidth ",miscpscolour('dykefail'),"\n");
-  o("  gsave 242 1363 $top_adjuncts_dy_from_boundings add translate ");
-  o("     90 rotate deckpairpathx stroke grestore");
+
+  foreach my $deck (@{ $c{Decks} }) {
+    o("  $lw setlinewidth ",miscpscolour($deck->{Colour}),"\n");
+    o("  gsave @{ $deck->{Pos} } ");
+    my $adjunct = $adjuncts_dy_from_boundings{ $deck->{dyAdjunct} };
+    if (defined $adjunct) { o("$adjunct add translate"); }
+    o("     ");
+    my $rotate = $deck->{Rotate};
+    if ($rotate) { o(" $rotate rotate "); }
+    o("deckpairpathx stroke grestore");
+  }
 }
 
 sub sea_track(){
@@ -932,7 +937,7 @@ sub hs_initial_1 ($$$;$$$) {
   my $demo_w = $demo_x0 + $dyke_l * 0.60;
   o("  % HS I $colour\n");
   o("  gsave\n");
-  o("    550 1705 $top_adjuncts_dy_from_boundings add translate\n");
+  o("    550 1705 $adjuncts_dy_from_boundings{Top} add translate\n");
   o("    ", ($xi*$interval), " ", (($yi-1)*$interval), " translate\n");
   if ($fn) {
     o("  gsave\n");
@@ -970,7 +975,7 @@ sub hs_initial () {
 sub play_hint () {
   my $sz = 20;
   o("  gsave ",miscpscolour('hinttext'),
-    " 260 1715 $top_adjuncts_dy_from_boundings add translate\n");
+    " 260 1715 $adjuncts_dy_from_boundings{$c{PlayHintdyAdjunct}} add translate\n");
   o("  /Helvetica-Bold findfont $sz scalefont setfont\n");
   my @t = split /\n/, $c{PlayHint};
   foreach my $i (0..$#t) {
index 65b528574695a31763d01561c280b72d7e392241..4c061aefba939a7cc9f70d19f34157aa32c986ba 100644 (file)
@@ -67,8 +67,14 @@ END
    Overall => [ 34, -15 ],
    OverallOn => { a4 => [ 0, -17 ] },
  },
+ PlayHintdyAdjunct => 'Top',
  PA_HS_HS => { green => [0, -0.40] },
  PA_Outercoast_Vertices => [
    { Re => qr{Noorderzijlvest}, PA => [ 100,-50 ] },
  ],
+ Decks => [
+   { Colour => 'playerdeck', Pos => [ 401, 44 ], dyAdjunct => 'Bottom' },
+   { Colour => 'dykefail', Pos => [ 242, 1363 ], dyAdjunct => 'Top',
+                          Rotate => 90 },
+ ],
 );