version 1.2 | | version 1.3 |
---|
| | |
# 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) { |
| | |
# 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; |
| | |
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; |
| | |
| | |
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"; |
| | |
$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; |
| | |
} | | } |
| | |
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 |
# | | # |
| | |
| | |
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, |
| | |
} | | } |
| | |
close(MAP); | | close(MAP); |
| | if ($depth != 0) { |
| | print "ERROR: map $map, mismatched arch/end, $depth\n"; |
| | } |
} | | } |