#!/opt/bin/perl use Storable; my $LIBDIR = $ENV{CROSSFIRE_LIBDIR} or die "\$CROSSFIRE_LIBDIR must be set\n"; my $T = 32; my $arch; umask 022; sub escape_html($) { local $_ = shift; s/([<>&])/sprintf "%d;", ord $1/ge; $_ } for my $path (@ARGV) { print "$path\n"; if (!-e "$path.png" || !-e "$path.pst" || -M "$path.pst" > -M $path || -M "$path.png" > -M $path) { # regenerate png and metainfo system "cfmap2png", $path; }; $arch ||= Storable::retrieve "$LIBDIR/archetypes.pst"; my $meta = Storable::retrieve "$path.pst"; open my $fh, ">:utf8", "$path.html" or die "$path.html: $!"; select $fh; my $W = $meta->{width} * $T; my $H = $meta->{height} * $T; my (@path) = split /\//, $path; print "", "", "
", ""; print "/ "; for (0 .. $#path - 1) { print "$path[$_] / "; } my @tile = map { $meta->{info}{"tile_path_$_"} ? "" : "" } 1..4; print "$path[-1] "; print " | ", "$tile[0] | ||
$tile[3] | "; print "", " | $tile[1] | ", "|
$tile[2] |
", escape_html $meta->{info}{msg}, "
"; print "";
if (my $as = $meta->{map}[$x][$y]) {
print " ($x|$y) ";
}
print "
| ";
}
print "