Difference for lib/adm/map_check from version 1.2 to 1.3


version 1.2 version 1.3
Line 24
 
Line 24
 # ARGUMENT PROCESSING  # ARGUMENT PROCESSING
 #  #
 # preset options  # preset options
 $cfdir = "/home/hugin/a/crossfire/cf-installroot";  $cfdir = "/export/home/crossfire/cf-installroot";
   
 # loop thru arg vector  # loop thru arg vector
 while (@ARGV) {  while (@ARGV) {
Line 92
 
Line 92
  # e.g. buttons, handles, gates, ...   # e.g. buttons, handles, gates, ...
  $CONNECT{$arch} = 1;   $CONNECT{$arch} = 1;
  }   }
    if ($type == 85) {
    $SB{$arch} = 1;
    }
   
 }  }
   
 print STDERR "DBG: ...done.\n" if $debug;  print STDERR "DBG: ...done.\n" if $debug;
Line 109
 
Line 113
  next if $visited{$map}; # skip if been here before   next if $visited{$map}; # skip if been here before
  $visited{$map} = 1; # flag it if not   $visited{$map} = 1; # flag it if not
   
    # skip random maps
    next if ($map =~ m#/!#);
   
 print STDERR "DBG: visiting $map\n" if $debug;  print STDERR "DBG: visiting $map\n" if $debug;
 #print "visiting $map\n" if $debug;  #print "visiting $map\n" if $debug;
   
Line 211
 
Line 218
  local($arch,$connected,$slaying,$exit,$x,$y, $rx, $ry);   local($arch,$connected,$slaying,$exit,$x,$y, $rx, $ry);
  local($lines,$fullmap);   local($lines,$fullmap);
  local($junk);   local($junk);
    $depth=0;
   
  # build full pathname (nb: map path starts with /) and open map file   # build full pathname (nb: map path starts with /) and open map file
  $fullmap = "$mapdir$map";   $fullmap = "$mapdir$map";
Line 220
 
Line 228
  $lines = 0;   $lines = 0;
   
  while ( <MAP> ) {   while ( <MAP> ) {
    if (/^tile_path_/) {
    ($junk,$slaying) = split;
    $_ = "$map $slaying"; # easy matching :-)
    s@^(/.*/)([^/]*)\s([^\./].*)$@\1\2 \1\3@;
    s@^(/.*/)([^/]*)\s(\.\./.*)$@\1\2 \1\3@;
    s@/[^/]*/\.\./@/@g;
    ($junk,$exit) = split;
    next if $visited{$exit};
   
    if ( (! -r "$mapdir$exit")  && ( $exit ne "/!") ) {
    print "ERROR: map $map, arch $arch, line $lines, no such exit $exit ($rx, $ry, to $x, $y)\n";
    next;
    }
    push(@MAPS,$exit);
    }
   
   
  $lines++;   $lines++;
  if (/^arch\s/) {   if (/^arch\s/) {
    # Note we have to do some checks here - that is because
    # if an object is inside an object, the value of $arch
    # is clobbered.
  ($junk,$arch) = split;   ($junk,$arch) = split;
   # if ($SB{$arch}) {
   # print "WARNING: spellbook found at map $map, line $lines, arch $arch\n";
   # }
    if (!defined($ARCHDB{$arch})) {
    print "FATAL: map $map, line $lines, bad archetype: $arch ($rx, $ry)\n";
    }
    $USED{$arch}=1;
  undef($slaying);   undef($slaying);
  undef($x);   undef($x);
  undef($y);   undef($y);
  undef($rx);   undef($rx);
  undef($ry);   undef($ry);
  undef($connected);   undef($connected);
    $depth++;
  }   }
  elsif (/^connected\s/) {   elsif (/^connected\s/) {
  ($junk,$connected) = split;   ($junk,$connected) = split;
Line 253
 
Line 289
  }   }
   
  next if !/^end$/; # continue iff not end of arch   next if !/^end$/; # continue iff not end of arch
    $depth--;
   
  #   #
  # CHECK 1: valid archetype?  
  #  
  if (!defined($ARCHDB{$arch})) {  
 #print STDERR "FATAL: map $map, line $lines, bad archetype: $arch\n";  
 print "FATAL: map $map, line $lines, bad archetype: $arch ($rx, $ry)\n";  
  next;  
  }  
  $USED{$arch}=1;  
  #  
  # CHECK 2: connect-arch actually connected?   # CHECK 2: connect-arch actually connected?
  # NB: if not, that's perfectly legal, but suspicious   # NB: if not, that's perfectly legal, but suspicious
  #   #
Line 277
 
Line 305
   
  next if !$EXITS{$arch}; # continue if not an exit   next if !$EXITS{$arch}; # continue if not an exit
   
   
  #   #
  # CHECK 3: exit-type arch, but no path given   # CHECK 3: exit-type arch, but no path given
  # Presumably the path defaults to the local map,   # Presumably the path defaults to the local map,
Line 347
 
Line 376
  }   }
   
  close(MAP);   close(MAP);
    if ($depth != 0) {
    print "ERROR: map $map, mismatched arch/end, $depth\n";
    }
 }  }


Legend:
line(s) removed in v.1.2 
line(s) changed
 line(s) added in v.1.3

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:06