chiark / gitweb /
preview png, actually make it a png
[pandemic-rising-tide.git] / generate-board
index 79c258824ae61ed0272fc1627074594839b60e51..9ce1dc23e4fd441521e71abc37fcd0e71f862f75 100755 (executable)
@@ -1,4 +1,50 @@
 #!/usr/bin/perl -w
+#
+# generate-board - program for generating playing board images
+#   for games very like Pandemic Rising Tide
+#
+# Copyright (C) 2019 Ian Jackson
+#
+# This program is dual licensed, GPv3+ or CC-BY-SA 4.0+.
+# It copies bits of itself into its output; those parts are CC-BY 4.0+.
+# Only to the Pandemic Rising Tide folks, it is permissively licensed.
+#
+#   This program is free software.
+#
+#   You can redistribute it and/or modify it under the terms of the
+#   GNU General Public License as published by the Free Software
+#   Foundation, either version 3 of the License, or (at your option)
+#   any later version; or (at your option), under the terms of the
+#   Creative Commons Attribution-ShareAlike International License,
+#   version 4.0 of that License, or (at your option), any later
+#   version.
+#
+#   This program copies pieces itself into the output.  Those pieces,
+#   when copied into the output, are additionally (at your option)
+#   available under a difference licence: they are made available
+#   under the Creative Commons Attribution International License,
+#   version 4.0 of that License, or (at your option), any later
+#   version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   General Public License Creative Commons Attribution-ShareAlike
+#   License or the for more details.
+#
+#   You should have received a copy of these licenses along with this
+#   program.  If not, see <https://www.gnu.org/licenses/> and
+#   <https://creativecommons.org/licenses/>.
+#
+# Pandemic and Pandemic Rising Tide are (I think) trademarks of Z-Man
+# games and I use them without permission.
+# 
+# For the avoidance of doubt, I do not consider this program to be a
+# derivative work of the game Pandemic Rising Tide.  However, it is
+# not very useful without a pair of game description files and the
+# only nontrivial game description files I know of are indeed such
+# derivatives.
+
 
 use strict;
 use Carp;
@@ -248,8 +294,8 @@ sub transform_coordinates () {
 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" );
+  my $adjunct = $adjuncts_dy_from_boundings{ $whadjunct//'' };
+  return "$x $y".( defined $adjunct and " $adjunct add translate" );
 }
 
 sub adjust_sea() {
@@ -794,7 +840,7 @@ sub decks(){
 
 sub sea_track(){
   o("% sea level track\n");
-  o("  gsave 11 700 translate\n");
+  o("  gsave ",pos_plus_dy_adjunct($c{PA}{SeaTrack})," translate\n");
   my $track = $c{SeaTrack};
   my $token_sz = $hs_sz;
   my $dy = $token_sz * 1.25;
@@ -984,7 +1030,7 @@ sub hs_initial () {
 sub play_hint () {
   my $sz = 20;
   o("  gsave ",miscpscolour('hinttext'),
-    " 260 1715 $adjuncts_dy_from_boundings{$c{PlayHintdyAdjunct}} add translate\n");
+    " ",pos_plus_dy_adjunct($c{PA}{PlayHint}),"\n");
   o("  /Helvetica-Bold findfont $sz scalefont setfont\n");
   my @t = split /\n/, $c{PlayHint};
   foreach my $i (0..$#t) {