chiark / gitweb /
preview png, actually make it a png
[pandemic-rising-tide.git] / generate-plag
index c39e583c4b61ca6622923a6b1da16d6524976bcc..28b4437993e07feceaa23b43d0c667e011825b2d 100755 (executable)
@@ -1,4 +1,41 @@
 #!/usr/bin/perl -w
+#
+# generate-plag - program for processing game board definitions
+#
+# Copyright (C) 2019 Ian Jackson
+#
+# This program is dual licensed, GPv3+ or CC-BY-SA 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 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;
@@ -7,24 +44,16 @@ BEGIN { unshift @INC, qw(.); }
 
 use Parse;
 
-sub plag_prs ($) {
-    my ($t) = @_;
-    $t = $` if $t =~ m/\n/;
-    $t =~ s/ //g;
-    $t =~ s/-//g;
-    return "$t";
-}
-
 sub output_planar_graph () {
   foreach my $ra (sort keys %region) {
     o(plag_prs($ra), "\n");
-    if ($ra eq 'NZ' || $ra eq 'L') { o(" :outer\n"); }
+    if ($ra eq $c{Sea} || $ra =~ m/^L2?$/) { o(" :outer\n"); }
     my $adjs = $region{$ra}{Adj};
     foreach my $adj (reverse @$adjs) {
       o(" ", plag_prs($adj->{Name}), "\n");
     }
   }
-  # RUST_BACKBACE=1 target/release/planar-graph <../pandemic-rising-tide/map.plag R DUAL OUTER-F2V OUTER-SPLIT B T OUTER-F2V OUTER-F12VA PCO CP RAE PRINT-VI-NAMES NLOPT WG t.dot | qtdebug/vtrace
+  # RUST_BACKTRACE=1 target/release/plag-mangler <../pandemic-rising-tide/map.plag R DUAL OUTER-F2V OUTER-SPLIT B T OUTER-F2V OUTER-F12VA PCO CP RAE PRINT-VI-NAMES NLOPT WG t.dot | qtdebug/vtrace
 
 }