ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.52 by root, Sat Aug 18 22:25:35 2007 UTC vs.
Revision 1.63 by root, Mon Dec 17 08:03:22 2007 UTC

14my $PNGNQ = "@PNGNQ@"; 14my $PNGNQ = "@PNGNQ@";
15 15
16use Getopt::Long; 16use Getopt::Long;
17use Coro::Event; 17use Coro::Event;
18use AnyEvent; 18use AnyEvent;
19use YAML::Syck ();
20use JSON::XS ();
19use IO::AIO (); 21use IO::AIO ();
20use File::Temp; 22use File::Temp;
21use Crossfire; 23use Crossfire;
22use Coro; 24use Coro;
23use Coro::AIO; 25use Coro::AIO;
24use Coro::Util; 26use Coro::Util;
25use POSIX (); 27use POSIX ();
26use Digest::MD5;
27use Carp; 28use Carp;
29use Coro::Channel;
28use Coro::Storable; $Storable::canonical = 1; 30use Coro::Storable; $Storable::canonical = 1;
29 31
30$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 32$SIG{QUIT} = sub { Carp::cluck "QUIT" };
31 33
32sub usage { 34sub usage {
96 if (!-f "$path/regions") { 98 if (!-f "$path/regions") {
97 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 99 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
98 exit 1 unless $FORCE; 100 exit 1 unless $FORCE;
99 } 101 }
100 102
101 system $RSYNC, "-a", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" 103 system $RSYNC, "-av", "--chmod=u=rwX,go=rX",
104 "$path/.", "$DATADIR/maps/.",
105 "--exclude", "CVS", "--exclude", "/world-precomposed",
106 "--delete", "--delete-excluded"
102 and die "map installation failed.\n"; 107 and die "map installation failed.\n";
103 108
104 print "maps installed successfully.\n"; 109 print "maps installed successfully.\n";
105} 110}
106 111
114 our $NFILE; 119 our $NFILE;
115 our $PATH; 120 our $PATH;
116 121
117 our $QUANTIZE = "+dither -colorspace RGB -colors 256"; 122 our $QUANTIZE = "+dither -colorspace RGB -colors 256";
118 123
119 our (@png, @trs, @arc, @res); # files we are interested in 124 our $c_arc = new Coro::Channel;
125 our $c_trs = new Coro::Channel;
126 our $c_res = new Coro::Channel;
127
128 our @c_png;
120 129
121 sub commit_png($$$) { 130 sub commit_png($$$) {
122 my ($name, $data, $T) = @_; 131 my ($name, $data, $T) = @_;
123 132
124 $FACEINFO{$name}{"data$T"} = $data; 133 $FACEINFO{$name}{"data$T"} = $data;
125 } 134 }
126 135
127 sub process_png { 136 sub process_png {
128 while (@png) { 137 while (@c_png) {
129 my ($path, $delete) = @{pop @png}; 138 my ($path, $delete) = @{pop @c_png};
130 139
131 my $png; 140 my $png;
132 aio_lstat $path; 141 aio_lstat $path;
133 my ($size, $mtime) = (stat _)[7,9]; 142 my ($size, $mtime) = (stat _)[7,9];
134 143
165 if ($w % $T || $h % $T) { 174 if ($w % $T || $h % $T) {
166 warn "$path: weird png size ($w $h), skipping.\n"; 175 warn "$path: weird png size ($w $h), skipping.\n";
167 next; 176 next;
168 } 177 }
169 178
179 (my $base = $stem) =~ s/^.*\///;
180
181 my $fi = $FACEINFO{$base};
182 unless ($fi) {
183 #warn "$path: <$base> not referenced by any archetype, skipping.\n";
184 #next;
185 }
186
187 my $arc = $fi->{arc} || { };
188
170 unless ($path =~ /~$/) { 189 unless ($path =~ /~$/) {
171 # possibly enlarge 190 # possibly enlarge
172 if (0 > aio_stat "$stem.64x64.png") { 191 if (0 > aio_stat "$stem.64x64.png") {
173 my $other = "$stem.64x64.png~"; 192 my $other = "$stem.64x64.png~";
174 193
175 if (0 > aio_lstat $other or (-M _) > (-M $path)) { 194 if (0 > aio_lstat $other or (-M _) > (-M $path)) {
176 fork_sub { 195 fork_sub {
177 my $CROP; 196 my $CROP;
178 my $SRC = "png:\Q$path\E"; 197 my $SRC = "png:\Q$path\E";
179 198
180 # check if this is a wall. ultra-ugly. ultra-ultra-ugly. 199 my $is_floor = $arc->{is_floor};
200 my $is_wall = 0;
201
202 my ($wall_pfx, $wall_dir, $wall_sfx);
203
204 if (
205 !$is_floor
206 && !$arc->{alive}
207 && $arc->{move_block} eq "all"
181 if ($path =~ /^(.*\/wall\/.*_)([0-9A-F])(\.x11.*\.png)$/) { 208 && $path =~ /^(.*_)([0-9A-F])(\.x11.*\.png)$/
209 ) {
182 my ($pfx, $dir, $sfx) = ($1, hex $2, $3); 210 ($wall_pfx, $wall_dir, $wall_sfx) = ($1, hex $2, $3);
183 #check for 0..F images to be sure(?) this is a wall 211
184 unless (grep { !-e sprintf "%s%X%s", $pfx, $_, $sfx } 0..15) { 212 unless (grep { !-e sprintf "%s%X%s", $wall_pfx, $_, $wall_sfx } 0..15) {
213 $is_wall = 1;
214 }
215 }
216
217 if ($is_wall || $is_floor) {
185 # add a 4px border and add other images around it 218 # add a 4px border and add other images around it
186 $CROP = "-shave 8x8 +repage"; 219 $CROP = "-shave 8x8 +repage";
187 220
188 $w += 8; 221 $w += 8;
189 $h += 8; 222 $h += 8;
190 223
191 $SRC = "-size ${w}x${h} xc:transparent"; 224 $SRC = "-size ${w}x${h} xc:transparent";
192 $SRC .= " png:\Q$path\E -geometry +4+4 -composite"; 225 $SRC .= " png:\Q$path\E -geometry +4+4 -composite";
193 226
194 # 8 surrounding images 227 # 8 surrounding images
195 for ( 228 for (
196 # x y b r0 r1 229 # x y b r0 r1
197 [-1, -1, 0, 6], 230 [-1, -1, 0, 6],
198 [ 0, -1, 1, 10, 14], 231 [ 0, -1, 1, 10, 14],
199 [+1, -1, 0, 12], 232 [+1, -1, 0, 12],
200 233
201 [-1, 0, 8, 5, 7], 234 [-1, 0, 8, 5, 7],
202 # 235 #
203 [+1, 0, 2, 5, 13], 236 [+1, 0, 2, 5, 13],
204 237
205 [-1, +1, 0, 3], 238 [-1, +1, 0, 3],
206 [ 0, +1, 4, 10, 11], 239 [ 0, +1, 4, 10, 11],
207 [+1, +1, 0, 9], 240 [+1, +1, 0, 9],
208 ) { 241 ) {
209 my ($x, $y, $d, $r0, $r1) = @$_; 242 my ($x, $y, $d, $r0, $r1) = @$_;
243
244 my $tile = $is_floor ? $path
245 : $is_wall ? sprintf "%s%X%s", $wall_pfx, ($wall_dir & $d) ? $r1 : $r0, $wall_sfx
246 : die;
247
210 $SRC .= sprintf " png:%s%X%s -geometry %+d%+d -composite", 248 $SRC .= sprintf " png:%s -geometry %+d%+d -composite",
211 "\Q$pfx", 249 "\Q$tile",
212 ($dir & $d) ? $r1 : $r0,
213 "\Q$sfx",
214 $x * ($w - 8) + 4, 250 $x * ($w - 8) + 4,
215 $y * ($h - 8) + 4; 251 $y * ($h - 8) + 4;
216 }
217 } 252 }
218 } 253 }
219 254
220 system "convert -depth 8 $SRC rgba:-" 255 system "convert -depth 8 $SRC rgba:-"
221 . "| $exec_prefix/bin/cfhq2xa $w $h 0" 256 . "| $exec_prefix/bin/cfhq2xa $w $h 0"
225 die "$other~ has zero size, aborting." unless -s "$other~"; 260 die "$other~ has zero size, aborting." unless -s "$other~";
226 rename "$other~", $other; 261 rename "$other~", $other;
227 }; 262 };
228 } 263 }
229 264
230 push @png, [$other, !$CACHE]; 265 push @c_png, [$other, !$CACHE];
231 } 266 }
232 267
233 # possibly scale down 268 # possibly scale down
234 if (0 > aio_stat "$stem.32x32.png") { 269 if (0 > aio_stat "$stem.32x32.png") {
235 my $other = "$stem.32x32.png~"; 270 my $other = "$stem.32x32.png~";
260 rename "$other~", $other; 295 rename "$other~", $other;
261 }; 296 };
262 } 297 }
263 298
264 #warn "scaled down $path to $other\n";#d# 299 #warn "scaled down $path to $other\n";#d#
265 push @png, [$other, !$CACHE]; 300 push @c_png, [$other, !$CACHE];
266 } 301 }
267 } 302 }
268 303
269 (my $face = $stem) =~ s/^.*\///; 304 (my $face = $stem) =~ s/^.*\///;
270 305
331 aio_unlink $path if $delete; 366 aio_unlink $path if $delete;
332 } 367 }
333 } 368 }
334 369
335 sub process_arc { 370 sub process_arc {
336 while (@arc) { 371 while (my $job = $c_arc->get) {
337 my ($dir, $file) = @{pop @arc}; 372 my ($dir, $file) = @$job;
338 373
339 my $arc; 374 my $arc;
340 aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ 375 aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/
341 376
342 my $arc = read_arch "$dir/$file"; 377 my $arc = read_arch "$dir/$file";
394 facings => $facings, 429 facings => $facings,
395 frames => \@frames, 430 frames => \@frames,
396 }; 431 };
397 } 432 }
398 433
399 for my $face ($o->{face} || (), @{$anim || []}) { 434 for ($o->{face} || (), @{$anim || []}) {
400 next if $face =~ /^facings\s|^blank.x11$|^empty.x11$/; 435 next if /^facings\s/;
401 436
437 my $face = $_;
438 $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates
439
402 my $info = $FACEINFO{$face} ||= {}; 440 my $info = $FACEINFO{$face} ||= { };
441 $info->{arc} = $o;
442
443 next if $face =~ /^blank.x11$|^empty.x11$/;
403 444
404 $info->{visibility} = $visibility if defined $visibility; 445 $info->{visibility} = $visibility if defined $visibility;
405 $info->{magicmap} = $magicmap if defined $magicmap; 446 $info->{magicmap} = $magicmap if defined $magicmap;
406 } 447 }
407 448
408 if (my $smooth = delete $o->{smoothface}) { 449 if (my $smooth = delete $o->{smoothface}) {
409 my %kv =split /\s+/, $smooth; 450 my %kv = split /\s+/, $smooth;
410 my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support 451 my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support
411 while (my ($face, $smooth) = each %kv) { 452 while (my ($face, $smooth) = each %kv) {
453 $FACEINFO{$smooth}{arc} = $o;
454
412 $FACEINFO{$face}{smooth} = $smooth; 455 $FACEINFO{$face}{smooth} = $smooth;
413 $FACEINFO{$face}{smoothlevel} = $level; 456 $FACEINFO{$face}{smoothlevel} = $level;
414 } 457 }
415 } 458 }
416 } 459 }
417 } 460 }
418 } 461 }
419 } 462 }
420 463
421 sub process_trs { 464 sub process_trs {
422 while (@trs) { 465 while (my $job = $c_trs->get) {
423 my ($dir, $file) = @{pop @trs}; 466 my ($dir, $file) = @$job;
424 my $path = "$dir/$file"; 467 my $path = "$dir/$file";
425 468
426 my $trs; 469 my $trs;
427 if (0 > aio_load $path, $trs) { 470 if (0 > aio_load $path, $trs) {
428 warn "$path: $!, skipping.\n"; 471 warn "$path: $!, skipping.\n";
450 493
451 $FILECACHE{$_[0]} 494 $FILECACHE{$_[0]}
452 } 495 }
453 496
454 sub process_res { 497 sub process_res {
455 while (@res) { 498 while (my $job = $c_res->get) {
456 my ($dir, $file, $type) = @{pop @res}; 499 my ($dir, $file, $type) = @$job;
457 500
458 my $data; 501 my $data;
459 aio_load "$dir/$file", $data; 502 aio_load "$dir/$file", $data;
460 503
461 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; 504 my $meta = load_cached "$dir/meta", sub { JSON::XS->new->utf8->relaxed->decode (shift) };
462 505
463 next if $meta && !exists $meta->{$file}; 506 utf8::decode $dir;
507 utf8::decode $file;
508
509 # a meta file for resources is now mandatory
510 unless (exists $meta->{$file}) {
511 warn "skipping $dir/$file\n" if $VERBOSE >= 3;
512 }
464 513
465 $meta = { 514 $meta = {
466 %{ $meta->{"" } || {} }, 515 %{ $meta->{"" } || {} },
467 %{ $meta->{$file} || {} }, 516 %{ $meta->{$file} || {} },
468 }; 517 };
470 if ($meta->{license} =~ s/^#//) { 519 if ($meta->{license} =~ s/^#//) {
471 $meta->{license} = ({ 520 $meta->{license} = ({
472 "pd" => "Public Domain", 521 "pd" => "Public Domain",
473 "gpl" => "GNU General Public License, version 3.0 or any later", 522 "gpl" => "GNU General Public License, version 3.0 or any later",
474 "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/", 523 "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/",
475 "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.5/", 524 "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.5 http://creativecommons.org/licenses/by/2.5/",
476 "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/", 525 "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/",
477 })->{$meta->{license}} 526 })->{$meta->{license}}
478 || warn "$dir/$file: license tag '$meta->{license}' not found."; 527 || warn "$dir/$file: license tag '$meta->{license}' not found.";
479 } 528 }
480 529
481 $file =~ s/\.res$//; 530 $file =~ s/\.res$//;
482 $file =~ s/\.(ogg|wav|jpg|png)$//; 531 $file =~ s/\.(ogg|wav|jpg|png)$//;
483 532
484 substr $dir, 0, 1 + length $PATH, ""; 533 substr $dir, 0, 1 + length $PATH, "";
485 534
535 if (my $filter = $meta->{cfutil_filter}) {
536 if ($filter eq "yaml2json") {
537 $data = JSON::XS::encode_json YAML::Syck::Load $data;
538 } else {
539 warn "$dir/$file: unknown filter $filter, skipping\n";
540 }
541 }
542
486 $RESOURCE{"$dir/$file"} = { 543 $RESOURCE{"$dir/$file"} = {
487 type => (delete $meta->{type}) || $type, 544 type => (exists $meta->{type} ? delete $meta->{type} : $type),
488 data => $data, 545 data => $data,
489 chksum => (Digest::MD5::md5 $data),
490 %$meta ? (meta => $meta) : (), 546 %$meta ? (meta => $meta) : (),
491 }; 547 };
492 } 548 }
493 } 549 }
494 550
506 my $dir = $path; 562 my $dir = $path;
507 substr $dir, 0, 1 + length $PATH, ""; 563 substr $dir, 0, 1 + length $PATH, "";
508 564
509 for my $file (@$nondirs) { 565 for my $file (@$nondirs) {
510 if ($dir =~ /^music(?:\/|$)/) { 566 if ($dir =~ /^music(?:\/|$)/) {
511 push @res, [$path, $file, 3] # FT_MUSIC 567 $c_res->put ([$path, $file, 3]) # FT_MUSIC
512 if $file =~ /\.(ogg)$/; 568 if $file =~ /\.(ogg)$/;
513 569
514 } elsif ($dir =~ /^sound(?:\/|$)/) { 570 } elsif ($dir =~ /^sound(?:\/|$)/) {
515 push @res, [$path, $file, 5] # FT_SOUND 571 $c_res->put ([$path, $file, 5]) # FT_SOUND
516 if $file =~ /\.(wav|ogg)$/; 572 if $file =~ /\.(wav|ogg)$/;
517 573
518 } elsif ($dir =~ /^res(?:\/|$)/) { 574 } elsif ($dir =~ /^res(?:\/|$)/) {
519 push @res, [$path, $file, 0] # FT_FACE
520 if $file =~ /\.(jpg|png)$/; 575 if ($file =~ /\.(jpg|png)$/) {
521 push @res, [$path, $file, 7] # FT_RSRC 576 $c_res->put ([$path, $file, 0]) # FT_FACE
522 if $file =~ /\.(res)$/; 577 } elsif ($file =~ /\.(res)$/) {
578 $c_res->put ([$path, $file, 7]) # FT_RSRC
579 } else {
580 $c_res->put ([$path, $file, undef]);
581 }
523 582
524 } elsif ($file =~ /\.png$/) { 583 } elsif ($file =~ /\.png$/) {
525 push @png, ["$path/$file", 0]; 584 push @c_png, ["$path/$file", 0];
526 585
527 } elsif ($file =~ /\.trs$/) { 586 } elsif ($file =~ /\.trs$/) {
528 push @trs, [$path, $file]; 587 $c_trs->put ([$path, $file]);
529 588
530 } elsif ($file =~ /\.arc$/) { 589 } elsif ($file =~ /\.arc$/) {
531 push @arc, [$path, $file]; 590 $c_arc->put ([$path, $file]);
532 591
533 } else { 592 } else {
534 warn "ignoring $path/$file\n" if $VERBOSE >= 3; 593 warn "ignoring $path/$file\n" if $VERBOSE >= 3;
535 } 594 }
536 } 595 }
555 if (!-d "$path/treasures") { 614 if (!-d "$path/treasures") {
556 warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; 615 warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n";
557 exit 1 unless $FORCE; 616 exit 1 unless $FORCE;
558 } 617 }
559 618
619 print "scanning files...\n" if $VERBOSE;
620
560 find_files $path; 621 find_files $path;
622
623 my @a_arc = map +(async \&process_arc), 1..2;
624 my @a_res = map +(async \&process_res), 1..2;
625 my @a_trs = map +(async \&process_trs), 1..2;
626
561 IO::AIO::flush; 627 IO::AIO::flush;
562 628
563 $_->join for ( 629 $c_res->put (undef) for @a_res;
630 $c_arc->put (undef) for @a_arc;
631 $c_trs->put (undef) for @a_trs;
632
633 print "start file scan, arc, res processing...\n" if $VERBOSE;
634
635 $_->join for @a_arc; # need to parse all archetypes before png processing
636
637 print "end arc, start png processing...\n" if $VERBOSE;
638
564 # four png crunchers work fine for my 2x smp machine 639 # four png crunchers work fine for my 2x smp machine
565 (async \&process_png), (async \&process_png), (async \&process_png), (async \&process_png), 640 my @a_png = map +(async \&process_png), 1..4;
566 (async \&process_trs), (async \&process_trs),
567 (async \&process_arc), (async \&process_arc),
568 (async \&process_res), (async \&process_res),
569 );
570 641
642 $_->join for (@a_trs, @a_res, @a_png);
643
644 print "scanning done, processing results...\n" if $VERBOSE;
571 { 645 {
572 # remove path prefix from editor_folder 646 # remove path prefix from editor_folder
573 substr $_->{editor_folder}, 0, 1 + length $path, "" 647 substr $_->{editor_folder}, 0, 1 + length $path, ""
574 for values %ARC; 648 for values %ARC;
575 649
650 print "resolving inheritance tree...\n" if $VERBOSE;
576 # resolve inherit 651 # resolve inherit
577 while () { 652 while () {
578 my $progress; 653 my $progress;
579 my $loop; 654 my $loop;
580 655
606 } 681 }
607 682
608 # remove base classes (by naming scheme, should use something like "baseclass xxx" to inherit 683 # remove base classes (by naming scheme, should use something like "baseclass xxx" to inherit
609 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC; 684 @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC;
610 685
686 print "writing archetypes...\n" if $VERBOSE;
611 open my $fh, ">:utf8", "$DATADIR/archetypes~" 687 open my $fh, ">:utf8", "$DATADIR/archetypes~"
612 or die "$DATADIR/archetypes~: $!"; 688 or die "$DATADIR/archetypes~: $!";
613 print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; 689 print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC];
614 } 690 }
615 691
616 { 692 {
693 print "writing treasures...\n" if $VERBOSE;
617 open my $fh, ">:utf8", "$DATADIR/treasures~" 694 open my $fh, ">:utf8", "$DATADIR/treasures~"
618 or die "$DATADIR/treasures~: $!"; 695 or die "$DATADIR/treasures~: $!";
619 print $fh $TRS; 696 print $fh $TRS;
620 } 697 }
621 698
622 { 699 {
700 print "processing facedata...\n" if $VERBOSE;
623 while (my ($k, $v) = each %FACEINFO) { 701 while (my ($k, $v) = each %FACEINFO) {
624 length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n"; 702 length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n";
625 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; 703 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n";
626 704
627 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 705 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
628 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 706 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
629 707
630 $v->{chksum32} = Digest::MD5::md5 $v->{data32};
631 $v->{chksum64} = Digest::MD5::md5 $v->{data64};
632
633 if (my $magicmap = $v->{magicmap}) { 708 if (my $magicmap = $v->{magicmap}) {
634 $magicmap =~ y/A-Z_\-/a-z/d; 709 $magicmap =~ y/A-Z_\-/a-z/d;
635 $v->{magicmap} = $COLOR{$magicmap}; 710 $v->{magicmap} = $COLOR{$magicmap};
636 } 711 }
637 }
638 712
713 delete $v->{arc};
714 }
715
716 print "writing facedata...\n" if $VERBOSE;
639 open my $fh, ">:perlio", "$DATADIR/facedata~" 717 open my $fh, ">:perlio", "$DATADIR/facedata~"
640 or die "$DATADIR/facedata~: $!"; 718 or die "$DATADIR/facedata~: $!";
641 719
642 print $fh freeze { 720 print $fh freeze {
643 version => 2, 721 version => 2,
644 faceinfo => \%FACEINFO, 722 faceinfo => \%FACEINFO,
645 animinfo => \%ANIMINFO, 723 animinfo => \%ANIMINFO,
646 resource => \%RESOURCE, 724 resource => \%RESOURCE,
647 }; 725 };
648 } 726 }
727
728 print "committing files...\n" if $VERBOSE;
649 729
650 for (qw(archetypes facedata treasures)) { 730 for (qw(archetypes facedata treasures)) {
651 chmod 0644, "$DATADIR/$_~"; 731 chmod 0644, "$DATADIR/$_~";
652 rename "$DATADIR/$_~", "$DATADIR/$_" 732 rename "$DATADIR/$_~", "$DATADIR/$_"
653 or die "$DATADIR/$_: $!"; 733 or die "$DATADIR/$_: $!";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines