Date: Tuesday July 25, 2000 @ 23:25 Author: cvs Update of /home/cvs/CVS/crossfire/lib/adm In directory boltzmann.eecs.berkeley.edu:/tmp/cvs-serv23516/lib/adm Modified Files: map_info map_check Log Message: lib/adm/map_info, lib/adm/map_check: Update to use new layout of installed files (share/crossfire), know about random exits (it doesn't do any checking to make sure the values are sane, which it probably should, but at least it won't complain about them), update to use /usr/bin/perl. MSW 7/25/2000 **************************************** Index: crossfire/lib/adm/map_info diff -u crossfire/lib/adm/map_info:1.1 crossfire/lib/adm/map_info:1.2 --- crossfire/lib/adm/map_info:1.1 Fri Apr 2 11:10:08 1999 +++ crossfire/lib/adm/map_info Tue Jul 25 23:25:58 2000 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # # This program is meant to use check crossfire (version 0.90.?) maps. # Program wanderers through mapfiles and reports all objects that @@ -13,11 +13,13 @@ # are not connected. This can be annoying at times, since many maps use # these objects for decorations. $CONNECTED = 0; -$LIB = "/home/hugin/a/crossfire/crossfire/lib"; +$LIB = "/home/hugin/a/crossfire/cf-installroot/share/crossfire"; $ARCH = "$LIB/archetypes"; $FACES = "$LIB/faces"; $ANIM = "$LIB/animations"; $MAPS = "$LIB/maps"; +# Set VERBOSE=1 if you want more output +$VERBOSE=0; if (! $ARGV[0]) { print "Usage: wanderer.pl map-directory ... > output.log\n"; @@ -117,19 +119,30 @@ print "Error: file $file isn't mapfile.\n"; return; } - print "Testing $file, "; - print /^name (.+)$/ ? $1 : "No mapname"; - print ", size [", /^x (\d+)$/ ? $1 : 16; - print ",", /^y (\d+)/ ? $1 : 16, "]"; - - if (! /^msg$/) { - print ", No message\n"; - } elsif (/(\w+@\S+)/) { - print ", $1\n"; - } else { - print ", Unknown\n"; + if ($VERBOSE) { + print "Testing $file, "; + print /^name (.+)$/ ? $1 : "No mapname"; + print ", size [", /^x (\d+)$/ ? $1 : 16; + print ",", /^y (\d+)/ ? $1 : 16, "]"; + + if (! /^msg$/) { + print ", No message\n"; + } elsif (/(\w+@\S+)/) { + print ", $1\n"; + } else { + print ", Unknown\n"; + } + $printmap=0; + } + else { + $name= /^name (.+)$/ ? $1 : "No mapname"; + $x= /^x (\d+)$/ ? $1 : 16; + $y= /^y (\d+)/ ? $1 : 16; + $mapname="Map $file, $name, size [$x, $y]\n" ; + $printmap=1; } + while (<IN>) { if (($m = (@_ = /^arch \S+\s*$/g)) > 1) { $parent = /^arch (\S+)\s*$/; @@ -145,6 +158,7 @@ } elsif (/^end$/) { &check_obj ("$inv$_"); } else { + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: Corrupted map file $file.\nSegment:\n$_\nLine: $.\n"; } } @@ -152,6 +166,7 @@ } elsif (/^More$/ || $m == 1) { &check_obj ($_); } else { + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: Corrupted map file $file.\nSegment:\n$_\nLine: $.\n"; } } @@ -167,12 +182,14 @@ if (! $arches{$1} && $last ne $1) { $last = $1; + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: Object $last is not defined in archetypes file ($x,$y), arch=$arch\n"; $missing{$last}++; } elsif ($ex{$1}) { &examine_exit ($_); } elsif ($tele{$1}) { if (/^food -?\d+$/) { + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: Teleport $1 has food field.\n"; } else { @@ -180,9 +197,13 @@ } } elsif ($conn{$1} && ! /^connected -?\d+$/) { $last = $1; - print " Warning: Object $last has not been connected, $x,$y\n" if ($CONNECTED); + if ($CONNECTED) { + if ($printmap) { print "$mapname"; $printmap=0;} + print " Warning: Object $last has not been connected, $x,$y\n" + } } elsif ($players{$1} && $last ne $1 && ! /^type / ) { $last = $1; + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: Player $last found in the map.\n"; } elsif ($1 eq "scroll" && ! /^msg$/) { $last = $1; @@ -197,13 +218,20 @@ $objects{$1}++; if (/^color_fg (\S+)$/ || /^color_bg (\S+)$/) { $last = $arch; + if ($printmap) { print "$mapname"; $printmap=0;} print " Warning: Object ".$arch." is setting color ($1), $x,$y\n"; } if (/^animation (\S+)$/) { - print "Error: Object $arch is using an unknown animation $1\n" if (! $anim{$1}); + if (! $anim{$1}) { + if ($printmap) { print "$mapname"; $printmap=0;} + print "Error: Object $arch is using an unknown animation $1\n" + } } if (/^face (\S+)$/) { - print "Error: Object $arch is using an unknown face $1\n" if (! $faces{$1}); + if (! $faces{$1}) { + if ($printmap) { print "$mapname"; $printmap=0;} + print "Error: Object $arch is using an unknown face $1\n" + } } } @@ -233,18 +261,21 @@ if (/^food (-?\d+)$/) { # old style exits, doesn't work with crossfire 0.90-1 + if ($printmap) { print "$mapname"; $printmap=0;} print " Error: ", &obj_name($_), " ($x1,$y1) -> ", "Old style level [$1] ($x,$y)\n"; } elsif (! defined ($to)) { # print " Closed: ", &obj_name($_), " ($x1,$y1)\n"; } else { # These are currently used be crossfire + return if ($to eq "/!"); if ($to =~ m!^/!) { $cdir = "$MAPS"; } else { ($cdir) = $file =~ m!(.*/)!; } if (! -f "$cdir$to") { + if ($printmap) { print "$mapname"; $printmap=0;} print " Missing: ", &obj_name($_), " ($x1,$y1) -> $to ($x,$y)\n"; } else { # print " OK: ", &obj_name($_), " ($x1,$y1) -> $to ($x,$y)\n"; @@ -258,7 +289,7 @@ opendir (DIR , $dir) || die "Can't open directory : $dir\n"; while ($file = readdir (DIR)) { - next if ($file eq "." || $file eq ".."); + next if ($file eq "." || $file eq ".." || $file eq "CVS"); $file = "$dir/$file"; push (@dirs, $file) if (-d $file); push (@maps, $file) if (-f $file); Index: crossfire/lib/adm/map_check diff -u crossfire/lib/adm/map_check:1.1 crossfire/lib/adm/map_check:1.2 --- crossfire/lib/adm/map_check:1.1 Fri Apr 2 11:10:08 1999 +++ crossfire/lib/adm/map_check Tue Jul 25 23:25:58 2000 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # # (C) Copyright Markus Weber, 1994. All rights reserved. # Permission is granted to use, copy, and modify for non-commercial use. @@ -9,11 +9,11 @@ # archdb=pathname-of-archetype-database *** not used *** # default ./ARCHDB .{dir,pag} # archetypes=pathname-of-archetypes-file -# default $cfdir/lib/archetypes +# default $cfdir/share/crossfire/archetypes # cfdir=pathname-to-crossfire-installation # default /opt/cf0901 (hardcoded) # mapdir=pathname-of-map-directory -# default $cfdir/lib/maps +# default $cfdir/share/crossfire/maps # start-map=map-path-of-starting map # default (init in archetypes) @@ -24,7 +24,7 @@ # ARGUMENT PROCESSING # # preset options -$cfdir = "/home/hugin/a/crossfire/cftest"; +$cfdir = "/home/hugin/a/crossfire/cf-installroot"; # loop thru arg vector while (@ARGV) { @@ -56,8 +56,8 @@ } # post-process -$mapdir = "$cfdir/lib/maps" unless defined($mapdir); -$archetypes = "$cfdir/lib/archetypes" unless defined($archetypes); +$mapdir = "$cfdir/share/crossfire/maps" unless defined($mapdir); +$archetypes = "$cfdir/share/crossfire/archetypes" unless defined($archetypes); print STDERR "DBG: archetypes=$archetypes\n" if $debug > 5; print STDERR "DBG: archdb=$archdb\n" if $debug > 5; print STDERR "DBG: mapdir=$mapdir\n" if $debug > 5; @@ -335,7 +335,7 @@ # this is check 4, finally. # if exit map can't be opened, complain and continue # - if ( ! (-r "$mapdir$exit") ) { + if ( (! -r "$mapdir$exit") && ( $exit ne "/!") ) { #print STDERR "ERROR: map $map, arch $arch, line $lines, no such exit $exit\n"; print "ERROR: map $map, arch $arch, line $lines, no such exit $exit ($rx, $ry, to $x, $y)\n"; next;