chiark / gitweb /
introduce pos_plus_dy_adjunct
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Mar 2019 20:27:15 +0000 (20:27 +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 1cc324280a60cdb0ef2c3ffec89794209e5bfdf2..c801bedb2998b17318148e6f08206cd24dec895e 100755 (executable)
@@ -245,6 +245,13 @@ sub transform_coordinates () {
   $mid = ($lims[1] - $lims[0]) * 0.5;
 }
 
+sub pos_plus_dy_adjunct ($) {
+  my ($cval) = @_;
+  my ($x,$y,$whadjunct) = @$cval;
+  my $adjunct = $adjuncts_dy_from_boundings{ $whadjunct };
+  return "$x $y ".( defined $adjunct and "$adjunct add translate" );
+}
+
 sub adjust_sea() {
   # Adjusts the top and bottom edges of the sea
   my $poly = $region{$c{Sea}}{Polygon};
@@ -778,10 +785,7 @@ sub decks(){
 
   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("     ");
+    o("  gsave ".pos_plus_dy_adjunct($deck->{PosAdy})."     ");
     my $rotate = $deck->{Rotate};
     if ($rotate) { o(" $rotate rotate "); }
     o("deckpairpathx stroke grestore");
index 4c061aefba939a7cc9f70d19f34157aa32c986ba..9aaa4cdaea3220835559e7ff0b5336516058214b 100644 (file)
@@ -73,8 +73,7 @@ END
    { Re => qr{Noorderzijlvest}, PA => [ 100,-50 ] },
  ],
  Decks => [
-   { Colour => 'playerdeck', Pos => [ 401, 44 ], dyAdjunct => 'Bottom' },
-   { Colour => 'dykefail', Pos => [ 242, 1363 ], dyAdjunct => 'Top',
-                          Rotate => 90 },
+   { Colour => 'playerdeck', PosAdy => [ 401, 44, 'Bottom' ] },
+   { Colour => 'dykefail', PosAdy => [ 242, 1363, 'Top'], Rotate => 90 },
  ],
 );