From 452226725a1bb9f4b1d0f5d3d23390cc42ae0ca7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 10 Mar 2019 20:27:15 +0000 Subject: [PATCH] introduce pos_plus_dy_adjunct NFC --- generate-board | 12 ++++++++---- misc-data.pl | 5 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/generate-board b/generate-board index 1cc3242..c801bed 100755 --- a/generate-board +++ b/generate-board @@ -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"); diff --git a/misc-data.pl b/misc-data.pl index 4c061ae..9aaa4cd 100644 --- a/misc-data.pl +++ b/misc-data.pl @@ -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 }, ], ); -- 2.30.2