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.56 by root, Sun Aug 19 15:47:56 2007 UTC vs.
Revision 1.62 by root, Mon Sep 10 18:30:30 2007 UTC

21use Crossfire; 21use Crossfire;
22use Coro; 22use Coro;
23use Coro::AIO; 23use Coro::AIO;
24use Coro::Util; 24use Coro::Util;
25use POSIX (); 25use POSIX ();
26use Digest::MD5;
27use Carp; 26use Carp;
28use Coro::Channel; 27use Coro::Channel;
29use Coro::Storable; $Storable::canonical = 1; 28use Coro::Storable; $Storable::canonical = 1;
30 29
31$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 30$SIG{QUIT} = sub { Carp::cluck "QUIT" };
97 if (!-f "$path/regions") { 96 if (!-f "$path/regions") {
98 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 97 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
99 exit 1 unless $FORCE; 98 exit 1 unless $FORCE;
100 } 99 }
101 100
102 system $RSYNC, "-a", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" 101 system $RSYNC, "-av", "--chmod=u=rwX,go=rX",
102 "$path/.", "$DATADIR/maps/.",
103 "--exclude", "CVS", "--exclude", "/world-precomposed",
104 "--delete", "--delete-excluded"
103 and die "map installation failed.\n"; 105 and die "map installation failed.\n";
104 106
105 print "maps installed successfully.\n"; 107 print "maps installed successfully.\n";
106} 108}
107 109
174 176
175 (my $base = $stem) =~ s/^.*\///; 177 (my $base = $stem) =~ s/^.*\///;
176 178
177 my $fi = $FACEINFO{$base}; 179 my $fi = $FACEINFO{$base};
178 unless ($fi) { 180 unless ($fi) {
179 warn "$path: <$base> not referenced by any archetype, skipping.\n"; 181 #warn "$path: <$base> not referenced by any archetype, skipping.\n";
180 next; 182 #next;
181 } 183 }
182 184
183 my $arc = $FACEINFO{$base}{arc} 185 my $arc = $fi->{arc} || { };
184 or die "FATAL: internal error <$base>, cannot continue";
185 186
186 unless ($path =~ /~$/) { 187 unless ($path =~ /~$/) {
187 # possibly enlarge 188 # possibly enlarge
188 if (0 > aio_stat "$stem.64x64.png") { 189 if (0 > aio_stat "$stem.64x64.png") {
189 my $other = "$stem.64x64.png~"; 190 my $other = "$stem.64x64.png~";
426 facings => $facings, 427 facings => $facings,
427 frames => \@frames, 428 frames => \@frames,
428 }; 429 };
429 } 430 }
430 431
431 for my $face ($o->{face} || (), @{$anim || []}) { 432 for ($o->{face} || (), @{$anim || []}) {
432 next if $face =~ /^facings\s/; 433 next if /^facings\s/;
434
435 my $face = $_;
436 $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates
433 437
434 my $info = $FACEINFO{$face} ||= { }; 438 my $info = $FACEINFO{$face} ||= { };
435 $info->{arc} = $o; 439 $info->{arc} = $o;
436 440
437 next if $face =~ /^blank.x11$|^empty.x11$/; 441 next if $face =~ /^blank.x11$|^empty.x11$/;
493 my ($dir, $file, $type) = @$job; 497 my ($dir, $file, $type) = @$job;
494 498
495 my $data; 499 my $data;
496 aio_load "$dir/$file", $data; 500 aio_load "$dir/$file", $data;
497 501
502
498 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; 503 my $meta = load_cached "$dir/meta", sub { JSON::XS->new->utf8->relaxed->decode (shift) };
499 504
500 next if $meta && !exists $meta->{$file}; 505 utf8::decode $dir;
506 utf8::decode $file;
507
508 # a meta file for resources is now mandatory
509 unless (exists $meta->{$file}) {
510 warn "skipping $dir/$file\n" if $VERBOSE >= 3;
511 next;
512 }
501 513
502 $meta = { 514 $meta = {
503 %{ $meta->{"" } || {} }, 515 %{ $meta->{"" } || {} },
504 %{ $meta->{$file} || {} }, 516 %{ $meta->{$file} || {} },
505 }; 517 };
521 substr $dir, 0, 1 + length $PATH, ""; 533 substr $dir, 0, 1 + length $PATH, "";
522 534
523 $RESOURCE{"$dir/$file"} = { 535 $RESOURCE{"$dir/$file"} = {
524 type => (delete $meta->{type}) || $type, 536 type => (delete $meta->{type}) || $type,
525 data => $data, 537 data => $data,
526 chksum => (Digest::MD5::md5 $data),
527 %$meta ? (meta => $meta) : (), 538 %$meta ? (meta => $meta) : (),
528 }; 539 };
529 } 540 }
530 } 541 }
531 542
681 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; 692 length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n";
682 693
683 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 694 length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
684 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 695 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
685 696
686 $v->{chksum32} = Digest::MD5::md5 $v->{data32};
687 $v->{chksum64} = Digest::MD5::md5 $v->{data64};
688
689 if (my $magicmap = $v->{magicmap}) { 697 if (my $magicmap = $v->{magicmap}) {
690 $magicmap =~ y/A-Z_\-/a-z/d; 698 $magicmap =~ y/A-Z_\-/a-z/d;
691 $v->{magicmap} = $COLOR{$magicmap}; 699 $v->{magicmap} = $COLOR{$magicmap};
692 } 700 }
693 701

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines