chiark / gitweb /
Move knowledge of sea name to %c, change adjust_nz
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Mar 2019 18:30:45 +0000 (18:30 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Mar 2019 18:35:54 +0000 (18:35 +0000)
NFC

generate-board
misc-data.pl

index e21cd5449cea62b037e8b058aadb24adad7779d0..96d83c79fcbfb800ec5f2f224b7a816f892c5671 100755 (executable)
@@ -246,30 +246,31 @@ sub transform_coordinates () {
   $mid = ($lims[1] - $lims[0]) * 0.5;
 }
 
-sub adjust_nz() {
-  my $poly = $region{NZ}{Polygon};
+sub adjust_sea() {
+  # Adjusts the top and bottom edges of the sea
+  my $poly = $region{$c{Sea}}{Polygon};
   my %occurs;
   foreach my $v (@$poly) {
     $occurs{$v->{VxName}}++
   }
   foreach my $v (@$poly) {
-    $v->{NZ_Occurs} = $occurs{$v->{VxName}};
+    $v->{SeaOccurs} = $occurs{$v->{VxName}};
   }
-  #print STDERR " nz ".(scalar @$poly)."\n";
+  #print STDERR " sea ".(scalar @$poly)."\n";
   my $occurs_m = sub {
     my ($ei) = @_;
-    $poly->[($ei+@$poly) % @$poly]{NZ_Occurs} > 1
+    $poly->[($ei+@$poly) % @$poly]{SeaOccurs} > 1
   };
   for my $ei (0..$#$poly) {
     next if $occurs_m->($ei);
     next unless $occurs_m->($ei-1);
     next unless $occurs_m->($ei+1);
-    #print STDERR " nz would adjust $poly->[$ei]{VxName}\n";
+    #print STDERR " sea would adjust $poly->[$ei]{VxName}\n";
     # adjust coord outwards
   }
   for my $ei (0..$#$poly) {
     next unless $occurs_m->($ei);
-    #print STDERR " nz occurs_m $ei $poly->[$ei]{VxName}\n";
+    #print STDERR " sea occurs_m $ei $poly->[$ei]{VxName}\n";
     next unless $occurs_m->($ei-1);
     my $dleft = mkvec(-1000,0);
     foreach my $which (0,-1) {
@@ -278,10 +279,10 @@ sub adjust_nz() {
       my $posj = \ $poly->[$ej]{Pos};
       my $posk = \ $poly->[$ek]{Pos};
       my $dout = $$posk - $$posj;
-      #print STDERR " nz adj j=$ej ",prvec($$posj)," $poly->[$ej]{VxName}\n";
-      #print STDERR " nz adj k=$ek ",prvec($$posk)," $poly->[$ek]{VxName}\n";
+      #print STDERR " sea adj j=$ej ",prvec($$posj)," $poly->[$ej]{VxName}\n";
+      #print STDERR " sea adj k=$ek ",prvec($$posk)," $poly->[$ek]{VxName}\n";
       if ($poly->[$ej]{VxName} =~ /Noorderzijlvest/) {
-       #print STDERR " nz adj extra\n";
+       #print STDERR " sea adj extra\n";
        $$posk = $$posj + 10 * mkvec(100,-50);
       }
       $$posj = $$posj + $dleft + $dout*10;
@@ -976,7 +977,7 @@ prep_region_rmap();
 read_faces();
 calculate_centres();
 transform_coordinates();
-adjust_nz();
+adjust_sea();
 
 computeboundings();
 preamble();
index e8b3e1993dc66488c3ee723f4f9c3eeb7b9bf782..48bb0e5e49fb9ef432e50eb99f4ac068a0dc8307 100644 (file)
@@ -25,6 +25,7 @@ our %c =
      playerdeck => 'fff',
      hinttext   => '000',
  },
+ Sea => 'NZ',
  DisplayNames => {
      ZZ => 'Zuiderzee',
      NZ => 'Noordzee',