ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cfmaps/cfmap2html
(Generate patch)

Comparing cfmaps/cfmap2html (file contents):
Revision 1.26 by root, Wed Feb 14 03:00:33 2007 UTC vs.
Revision 1.29 by root, Thu Jun 21 12:30:10 2007 UTC

15# 15#
16# You should have received a copy of the GNU General Public License 16# You should have received a copy of the GNU General Public License
17# along with cfmaps; if not, write to the Free Software 17# along with cfmaps; if not, write to the Free Software
18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 19
20our $VERSION = '1.212'; 20our $VERSION = '2.001';
21 21
22use Storable; 22use Crossfire 1.0;
23
24my $LIBDIR = $ENV{CROSSFIRE_LIBDIR}
25 or die "\$CROSSFIRE_LIBDIR must be set\n";
26 23
27my $T = 32; 24my $T = 32;
28 25
29my $arch; 26my $arch;
30 27
32 local $_ = shift; 29 local $_ = shift;
33 s/([<>&])/sprintf "&#%d;", ord $1/ge; 30 s/([<>&])/sprintf "&#%d;", ord $1/ge;
34 $_ 31 $_
35} 32}
36 33
34my @cfmap2png;
35
37for my $path (@ARGV) { 36for my $path (@ARGV) {
38 (my $base = $path) =~ s/\.map//; 37 (my $base = $path) =~ s/\.map//;
39# print STDERR "$path\n"; 38# print STDERR "$path\n";
40 39
41 if (!-e "$base.png" 40 if (!-e "$base.png"
42 || !-e "$base.pst"
43 || -M "$base.pst" > -M $path
44 || -M "$base.png" > -M $path) { 41 || -M "$base.png" > -M "$base.map") {
45 # regenerate png and metainfo 42 # regenerate png and metainfo
43 push @cfmap2png, $path;
44 };
45}
46 46
47 system "cfmap2png", $path; 47system "cfmap2png", @cfmap2png
48 }; 48 if @cfmap2png;
49 49
50for my $path (@ARGV) {
51 (my $base = $path) =~ s/\.map//;
50 if (!-e "$base.xhtml" 52 if (!-e "$base.xhtml"
51 || -M "$base.xhtml" > -M "$base.pst") { 53 || -M "$base.xhtml" > -M "$base.map") {
52 $arch ||= Storable::retrieve "$LIBDIR/archetypes.pst"; 54
53 my $meta = Storable::retrieve "$base.pst"; 55 Crossfire::load_archetypes
56 unless %ARCH;
57
58 my $meta = read_arch "$base.map";
54 59
55 open my $fh, ">:utf8", "$base.xhtml" 60 open my $fh, ">:utf8", "$base.xhtml"
56 or die "$base.xhtml: $!"; 61 or die "$base.xhtml: $!";
57 62
58 select $fh; 63 select $fh;
113 escape_html $meta->{info}{msg}, 118 escape_html $meta->{info}{msg},
114 "</p>"; 119 "</p>";
115 120
116 print "<table class='map'>"; 121 print "<table class='map'>";
117 122
118 my %ignore = map +($_ => 1), qw(name _name x y); 123 my %ignore = map +($_ => 1), qw(name _name _atype x y);
119 my %is_exit = map +($_ => 1), 41, 57, 66; 124 my %is_exit = map +($_ => 1), 41, 57, 66;
120 125
121 for my $y (0.. $meta->{height} - 1) { 126 for my $y (0.. $meta->{height} - 1) {
122 print "<tr>"; 127 print "<tr>";
123 for my $x (0.. $meta->{width} - 1) { 128 for my $x (0.. $meta->{width} - 1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines